+

Raise LdapServerException instead of string

Benjamin Renard [2015-04-01 15:07:49]
Raise LdapServerException instead of string
Filename
LdapServer.py
diff --git a/LdapServer.py b/LdapServer.py
index 81258f9..4c4c9e5 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 'LdapServer - Error connecting and binding to LDAP server : %s' % e
+			raise LdapServerException('LdapServer - Error connecting and binding to LDAP server : %s' % error)
 		else:
 			logging.log(level,error)

@@ -106,3 +106,7 @@ class LdapServer(object):
 				return obj[attr][0]
 			else:
 				return None
+
+class LdapServerException(BaseException):
+	def __init__(self,msg):
+		BaseException.__init__(self, msg)
ViewGit