Raise LdapServerException instead of string
This commit is contained in:
parent
c0495e99b3
commit
0a10f2f984
1 changed files with 5 additions and 1 deletions
|
@ -23,7 +23,7 @@ class LdapServer(object):
|
||||||
|
|
||||||
def _error(self,error,level=logging.WARNING):
|
def _error(self,error,level=logging.WARNING):
|
||||||
if self.raiseOnError:
|
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:
|
else:
|
||||||
logging.log(level,error)
|
logging.log(level,error)
|
||||||
|
|
||||||
|
@ -106,3 +106,7 @@ class LdapServer(object):
|
||||||
return obj[attr][0]
|
return obj[attr][0]
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
class LdapServerException(BaseException):
|
||||||
|
def __init__(self,msg):
|
||||||
|
BaseException.__init__(self, msg)
|
||||||
|
|
Loading…
Reference in a new issue