log error message instead of traceback
This commit is contained in:
parent
5bda74eaf9
commit
6bf4d75a60
|
@ -1,5 +1,4 @@
|
|||
import json
|
||||
import traceback
|
||||
from typing import List, Union
|
||||
|
||||
import ldap3
|
||||
|
@ -92,8 +91,8 @@ class Group:
|
|||
try:
|
||||
with self.ldap_srv.entry_ctx_for_group(self) as entry:
|
||||
entry.uniqueMember.add(dn)
|
||||
except ldap3.core.exceptions.LDAPAttributeOrValueExistsResult:
|
||||
logger.error(traceback.format_exc())
|
||||
except ldap3.core.exceptions.LDAPAttributeOrValueExistsResult as err:
|
||||
logger.warning(err)
|
||||
raise UserAlreadyInGroupError()
|
||||
self.members.append(username)
|
||||
|
||||
|
@ -102,7 +101,7 @@ class Group:
|
|||
try:
|
||||
with self.ldap_srv.entry_ctx_for_group(self) as entry:
|
||||
entry.uniqueMember.delete(dn)
|
||||
except ldap3.core.exceptions.LDAPCursorError:
|
||||
logger.error(traceback.format_exc())
|
||||
except ldap3.core.exceptions.LDAPCursorError as err:
|
||||
logger.warning(err)
|
||||
raise UserNotInGroupError()
|
||||
self.members.remove(username)
|
||||
|
|
Loading…
Reference in New Issue