1.1.3 Exceptions

The module defines the following exceptions:

exception LDAPError
This is the base class of all execeptions raised by the module. Unlike the C interface, errors are not returned as result codes, but are instead turned into exceptions, raised as soon an the error condition is detected.

The exceptions are accompanied by a dictionary possibly containing an string value for the key 'desc' (giving an English description of the error class) and/or a string value for the key 'info' (giving a string containing more information that the server may have sent).

A third possible field of this dictionary is 'matched' and is set to a truncated form of the name provided or alias dereferenced for the lowest entry (object or alias) that was matched.

exception ADMINLIMIT_EXCEEDED

exception AFFECTS_MULTIPLE_DSAS

exception ALIAS_DEREF_PROBLEM
A problem was encountered when dereferencing an alias. (Sets the 'matched' field.)
exception ALIAS_PROBLEM
An alias in the directory points to a nonexistent entry. (Sets the 'matched' field.)
exception ALREADY_EXISTS
The entry already exists. E.g. the dn specified with add() already exists in the DIT.
exception

exception AUTH_UNKNOWN
The authentication method specified to bind() is not known.
exception BUSY
The DSA is busy.
exception CLIENT_LOOP

exception COMPARE_FALSE
A compare operation returned false. (This exception should never be seen because compare() returns a boolean result.)
exception COMPARE_TRUE
A compare operation returned true. (This exception should never be seen because compare() returns a boolean result.)
exception CONFIDENTIALITY_REQUIRED
Indicates that the session is not protected by a protocol such as Transport Layer Security (TLS), which provides session confidentiality.
exception CONNECT_ERROR

exception CONSTRAINT_VIOLATION
An attribute value specified or an operation started violates some server-side constraint (e.g., a postalAddress has too many lines or a line that is too long or a password is expired).
exception CONTROL_NOT_FOUND

exception DECODING_ERROR
An error was encountered decoding a result from the LDAP server.
exception ENCODING_ERROR
An error was encountered encoding parameters to send to the LDAP server.
exception FILTER_ERROR
An invalid filter was supplied to methodsearch() (e.g. unbalanced parentheses).
exception INAPPROPRIATE_AUTH
Inappropriate authentication was specified (e.g. LDAP_AUTH_SIMPLE was specified and the entry does not have a userPassword attribute).
exception INAPPROPRIATE_MATCHING
Filter type not supported for the specified attribute.
exception INSUFFICIENT_ACCESS
The user has insufficient access to perform the operation.
exception INVALID_CREDENTIALS
Invalid credentials were presented during bind() or simple_bind(). (e.g., the wrong password).
exception INVALID_DN_SYNTAX
A syntactically invalid DN was specified. (Sets the 'matched' field.)
exception INVALID_SYNTAX
An attribute value specified by the client did not comply to the syntax defined in the server-side schema.
exception IS_LEAF
The object specified is a leaf of the diretcory tree. Sets the 'matched' field of the exception dictionary value.
exception LOCAL_ERROR
Some local error occurred. This is usually due to failed memory allocation.
exception LOOP_DETECT
A loop was detected.
exception MORE_RESULTS_TO_RETURN

exception NAMING_VIOLATION
A naming violation occurred. This is raised e.g. if the LDAP server has constraints about the tree naming.
exception NO_OBJECT_CLASS_MODS
Modifying the objectClass attribute as requested is not allowed (e.g. modifying structural object class of existing entry).
exception NOT_ALLOWED_ON_NONLEAF
The operation is not allowed on a non-leaf object.
exception NOT_ALLOWED_ON_RDN
The operation is not allowed on an RDN.
exception NOT_SUPPORTED

exception NO_MEMORY

exception NO_OBJECT_CLASS_MODS
Object class modifications are not allowed.
exception NO_RESULTS_RETURNED

exception NO_SUCH_ATTRIBUTE
The attribute type specified does not exist in the entry.
exception NO_SUCH_OBJECT
The specified object does not exist in the directory. Sets the 'matched' field of the exception dictionary value.
exception OBJECT_CLASS_VIOLATION
An object class violation occurred when the LDAP server checked the data sent by the client against the server-side schema (e.g. a "must" attribute was missing in the entry data).
exception OPERATIONS_ERROR
An operations error occurred.
exception OTHER
An unclassified error occurred.
exception PARAM_ERROR
An ldap routine was called with a bad parameter.
exception PARTIAL_RESULTS
Partial results only returned. This exception is raised if a referral is received when using LDAPv2. (This exception should never be seen with LDAPv3.)
exception PROTOCOL_ERROR
A violation of the LDAP protocol was detected.
exception RESULTS_TOO_LARGE
The result does not fit into a UDP packet. This happens only when using UDP-based CLDAP (connection-less LDAP) which is not supported anyway.
exception SASL_BIND_IN_PROGRESS

exception SERVER_DOWN
The LDAP library can't contact the LDAP server.
exception SIZELIMIT_EXCEEDED
An LDAP size limit was exceeded. This could be due to a `sizelimit' configuration on the LDAP server.
exception STRONG_AUTH_NOT_SUPPORTED
The LDAP server does not support strong authentication.
exception STRONG_AUTH_REQUIRED
Strong authentication is required for the operation.
exception TIMELIMIT_EXCEEDED
An LDAP time limit was exceeded.
exception TIMEOUT
A timelimit was exceeded while waiting for a result from the server.
exception TYPE_OR_VALUE_EXISTS
An attribute type or attribute value specified already exists in the entry.
exception UNAVAILABLE
The DSA is unavailable.
exception UNAVAILABLE_CRITICAL_EXTENSION
Indicates that the LDAP server was unable to satisfy a request because one or more critical extensions were not available. Either the server does not support the control or the control is not appropriate for the operation type.
exception UNDEFINED_TYPE
(Undocumented.)
exception UNWILLING_TO_PERFORM
The DSA is unwilling to perform the operation.
exception USER_CANCELLED
The operation was cancelled via the abandon() method.

The above exceptions are raised when a result code from an underlying API call does not indicate success.