Fix/improve error reporting
Benjamin Renard

Benjamin Renard commited on 2018-02-13 14:30:38
Showing 1 changed files, with 5 additions and 5 deletions.

... ...
@@ -23,7 +23,7 @@ class LdapServer(object):
23 23
 
24 24
 	def _error(self,error,level=logging.WARNING):
25 25
 		if self.raiseOnError:
26
-			raise LdapServerException('LdapServer - Error connecting and binding to LDAP server : %s' % error)
26
+			raise LdapServerException(error)
27 27
 		else:
28 28
 			logging.log(level,error)
29 29
 
... ...
@@ -67,7 +67,7 @@ class LdapServer(object):
67 67
 			self.con.add_s(dn,ldif)
68 68
 			return True
69 69
 		except ldap.LDAPError, e:
70
-			self._error("LdapServer - Error adding %s : %s" % (dn,e))
70
+			self._error("LdapServer - Error adding %s : %s" % (dn,e), logging.error)
71 71
 
72 72
 		return False
73 73
 
... ...
@@ -79,7 +79,7 @@ class LdapServer(object):
79 79
 			self.con.modify_s(dn,ldif)
80 80
 			return True
81 81
 		except ldap.LDAPError, e:
82
-			self._error("LdapServer - Error updating %s : %s\nOld : %s\nNew : %s" % (dn, e, old, new))
82
+			self._error("LdapServer - Error updating %s : %s\nOld : %s\nNew : %s" % (dn, e, old, new), logging.error)
83 83
 		return False
84 84
 
85 85
 	def rename_object(self,dn,new_rdn):
... ...
@@ -88,7 +88,7 @@ class LdapServer(object):
88 88
 			self.con.rename_s(dn,new_rdn)
89 89
 			return True
90 90
 		except ldap.LDAPError, e:
91
-			self._error("LdapServer - Error renaming %s in %s : %s" % (dn,new_rdn,e))
91
+			self._error("LdapServer - Error renaming %s in %s : %s" % (dn,new_rdn,e), logging.error)
92 92
 
93 93
 		return False
94 94
 
... ...
@@ -98,7 +98,7 @@ class LdapServer(object):
98 98
 			self.con.delete_s(dn)
99 99
 			return True
100 100
 		except ldap.LDAPError, e:
101
-			self._error("LdapServer - Error deleting %s : %s" % (dn,e))
101
+			self._error("LdapServer - Error deleting %s : %s" % (dn,e), logging.error)
102 102
 
103 103
 		return False
104 104
 
105 105