mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[mod] remove catch-all try and provide real exception
This commit is contained in:
parent
2a3096a170
commit
455b7e49c0
1 changed files with 11 additions and 9 deletions
|
@ -62,7 +62,8 @@ class Authenticator(BaseAuthenticator):
|
|||
try:
|
||||
# Retrieve identity
|
||||
who = self.con.whoami_s()
|
||||
except:
|
||||
except Exception as e:
|
||||
logger.warning("Error during ldap authentication process: %s", e)
|
||||
return False
|
||||
else:
|
||||
if who[3:] == self.userdn:
|
||||
|
@ -131,9 +132,9 @@ class Authenticator(BaseAuthenticator):
|
|||
|
||||
try:
|
||||
result = self.con.search_s(base, ldap.SCOPE_SUBTREE, filter, attrs)
|
||||
except:
|
||||
except Exception as e:
|
||||
logger.exception("error during LDAP search operation with: base='%s', "
|
||||
"filter='%s', attrs=%s", base, filter, attrs)
|
||||
"filter='%s', attrs=%s and exception %s", base, filter, attrs, e)
|
||||
raise MoulinetteError(169, m18n.g('ldap_operation_error'))
|
||||
|
||||
result_list = []
|
||||
|
@ -162,9 +163,9 @@ class Authenticator(BaseAuthenticator):
|
|||
|
||||
try:
|
||||
self.con.add_s(dn, ldif)
|
||||
except:
|
||||
except Exception as e:
|
||||
logger.exception("error during LDAP add operation with: rdn='%s', "
|
||||
"attr_dict=%s", rdn, attr_dict)
|
||||
"attr_dict=%s and exception %s", rdn, attr_dict, e)
|
||||
raise MoulinetteError(169, m18n.g('ldap_operation_error'))
|
||||
else:
|
||||
return True
|
||||
|
@ -183,8 +184,8 @@ class Authenticator(BaseAuthenticator):
|
|||
dn = rdn + ',' + self.basedn
|
||||
try:
|
||||
self.con.delete_s(dn)
|
||||
except:
|
||||
logger.exception("error during LDAP delete operation with: rdn='%s'", rdn)
|
||||
except Exception as e:
|
||||
logger.exception("error during LDAP delete operation with: rdn='%s' and exception %s", rdn, e)
|
||||
raise MoulinetteError(169, m18n.g('ldap_operation_error'))
|
||||
else:
|
||||
return True
|
||||
|
@ -212,9 +213,10 @@ class Authenticator(BaseAuthenticator):
|
|||
dn = new_rdn + ',' + self.basedn
|
||||
|
||||
self.con.modify_ext_s(dn, ldif)
|
||||
except:
|
||||
except Exception as e:
|
||||
logger.exception("error during LDAP update operation with: rdn='%s', "
|
||||
"attr_dict=%s, new_rdn=%s", rdn, attr_dict, new_rdn)
|
||||
"attr_dict=%s, new_rdn=%s and exception: %s", rdn, attr_dict,
|
||||
new_rdn, e)
|
||||
raise MoulinetteError(169, m18n.g('ldap_operation_error'))
|
||||
else:
|
||||
return True
|
||||
|
|
Loading…
Reference in a new issue