From e559f695895fcd7751bb89e08d7bbd4f3dda39fb Mon Sep 17 00:00:00 2001 From: kakwa Date: Wed, 27 May 2015 21:59:54 +0200 Subject: [PATCH] add exception handling --- ldapcherry/backend/backendLdap.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ldapcherry/backend/backendLdap.py b/ldapcherry/backend/backendLdap.py index 75d73d9..2dc9de2 100644 --- a/ldapcherry/backend/backendLdap.py +++ b/ldapcherry/backend/backendLdap.py @@ -167,6 +167,16 @@ class Backend(ldapcherry.backend.Backend): ) ldap_client.unbind_s() raise e + except ldap.NO_SUCH_OBJECT as e: + self._logger( + severity = logging.ERROR, + msg = "Search DN '" + basedn \ + + "' doesn't exist, check '" \ + + self.backend_name + ".userdn' or '" \ + + self.backend_name + ".groupdn'", + ) + ldap_client.unbind_s() + raise e ldap_client.unbind_s() return r