Fix/improve error reporting
This commit is contained in:
parent
0f69b2a713
commit
a525bd586b
1 changed files with 5 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue