From a525bd586b82b23528e42f47de48217d94660fe9 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Tue, 13 Feb 2018 15:30:38 +0100 Subject: [PATCH] Fix/improve error reporting --- LdapServer.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/LdapServer.py b/LdapServer.py index 93102ae..3ef0752 100644 --- a/LdapServer.py +++ b/LdapServer.py @@ -23,7 +23,7 @@ class LdapServer(object): def _error(self,error,level=logging.WARNING): if self.raiseOnError: - raise LdapServerException('LdapServer - Error connecting and binding to LDAP server : %s' % error) + raise LdapServerException(error) else: logging.log(level,error) @@ -67,7 +67,7 @@ class LdapServer(object): self.con.add_s(dn,ldif) return True except ldap.LDAPError, e: - self._error("LdapServer - Error adding %s : %s" % (dn,e)) + self._error("LdapServer - Error adding %s : %s" % (dn,e), logging.error) return False @@ -79,7 +79,7 @@ class LdapServer(object): self.con.modify_s(dn,ldif) return True except ldap.LDAPError, e: - self._error("LdapServer - Error updating %s : %s\nOld : %s\nNew : %s" % (dn, e, old, new)) + self._error("LdapServer - Error updating %s : %s\nOld : %s\nNew : %s" % (dn, e, old, new), logging.error) return False def rename_object(self,dn,new_rdn): @@ -88,7 +88,7 @@ class LdapServer(object): self.con.rename_s(dn,new_rdn) return True except ldap.LDAPError, e: - self._error("LdapServer - Error renaming %s in %s : %s" % (dn,new_rdn,e)) + self._error("LdapServer - Error renaming %s in %s : %s" % (dn,new_rdn,e), logging.error) return False @@ -98,7 +98,7 @@ class LdapServer(object): self.con.delete_s(dn) return True except ldap.LDAPError, e: - self._error("LdapServer - Error deleting %s : %s" % (dn,e)) + self._error("LdapServer - Error deleting %s : %s" % (dn,e), logging.error) return False