[python3-ldap] Feature requests: clearer errors

Richard Esplin richard-lists at esplins.org
Wed Apr 16 00:33:51 CEST 2014


Thank you for the great library. It is much more pythonic and easier to use 
than the old python-ldap.

My only challenge in using the library is that there appears to only be one 
exception: LDAPException, and many error messages are very cryptic. It would 
help to have distinct exceptions for common errors. A good starting point 
would be to look at the exceptions listed in the documentation for the python-
ldap module.

Specific things clients need to identify:
* auto_bind failure due to a bad basedn in the username parameter (python-ldap 
would return NO_SUCH_OBJECT), or due to a bad password (python-ldap would 
return INVALID_CREDENTIALS). Current message in the exception for both 
scenarios is: Exception: auto_bind not successful. This error made me first 
look at network connectivity.
* using an ldaps URL and connecting on the standard port without using the SSL 
flag given an error about the socket closing unexpectedly.
* using a CA cert in the local_certificate_file instead of the ca_certs_file 
gives an error about "[SSL] PEM lib (_ssl.c:2138)" that is completely  
unhelpful.

Hopefully this is a useful suggestion to you, and my documenting what I found 
helps others.

I plan on continuing to use this library. Thank you very much.

Richard

P.S. Please excuse the cross post. I originally posted this as an issue at 
Assemblia, but I couldn't figure out how to make it a public issue. Perhaps the 
re-post here might help other people diagnose these errors. I also hope the 
list activity helps anyone researching the library to see that it is reliable.


More information about the python3-ldap mailing list