From 6bf4d75a60201773b55233a6b125a28ed4197c9f Mon Sep 17 00:00:00 2001 From: Max Erenberg Date: Thu, 19 Aug 2021 00:19:57 +0000 Subject: [PATCH] log error message instead of traceback --- ceod/model/Group.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ceod/model/Group.py b/ceod/model/Group.py index e994774..cf99e57 100644 --- a/ceod/model/Group.py +++ b/ceod/model/Group.py @@ -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)