Class LdapException
Thrown to indicate that an Ldap exception has occurred. This is a general exception which includes a message and an Ldap result code. An LdapException can result from physical problems (such as network errors) as well as problems with Ldap operations detected by the server. For example, if an Ldap add operation fails because of a duplicate entry, the server returns a result code.
Inherited Members
Namespace: Swan.Ldap
Syntax
[Serializable]
public class LdapException : Exception, ISerializable, _Exception
Constructors
LdapException(String, LdapStatusCode, String, String, Exception)
Initializes a new instance of the LdapException class.
Constructs an exception with a detailed message obtained from the
specified MessageOrKey
String.
Additional parameters specify the result code, the message returned
from the server, and a matchedDN returned from the server.
The String is used either as a message key to obtain a localized
message from ExceptionMessages, or if there is no key in the
resource matching the text, it is used as the detailed message itself.
Declaration
public LdapException(string message, LdapStatusCode resultCode, string serverMsg = null, string matchedDN = null, Exception rootException = null)
Parameters
Type | Name | Description |
---|---|---|
String | message | The message. |
LdapStatusCode | resultCode | The result code returned. |
String | serverMsg | Error message specifying additional information from the server. |
String | matchedDN | The maximal subset of a specified DN which could be matched by the server on a search operation. |
Exception | rootException | The root exception. |
Properties
Cause
Returns the lower level Exception which caused the failure, if any. For example, an IOException with additional information may be returned on a CONNECT_ERROR failure.
Declaration
public Exception Cause { get; }
Property Value
Type | Description |
---|---|
Exception | The cause. |
LdapErrorMessage
Returns the error message from the Ldap server, if this message is available (that is, if this message was set). If the message was not set, this method returns null.
Declaration
public string LdapErrorMessage { get; }
Property Value
Type | Description |
---|---|
String | The error message or null if the message was not set. |
MatchedDN
Returns the part of a submitted distinguished name which could be matched by the server. If the exception was caused by a local error, such as no server available, the return value is null. If the exception resulted from an operation being executed on a server, the value is an empty string except when the result of the operation was one of the following:.
- NO_SUCH_OBJECT
- ALIAS_PROBLEM
- INVALID_DN_SYNTAX
- ALIAS_DEREFERENCING_PROBLEM
Declaration
public string MatchedDN { get; }
Property Value
Type | Description |
---|---|
String | The matched dn. |
Message
Declaration
public override string Message { get; }
Property Value
Type | Description |
---|---|
String |
Overrides
ResultCode
Returns the result code from the exception.
The codes are defined as public final static int
members
of the Ldap Exception class. If the exception is a
result of error information returned from a directory operation, the
code will be one of those defined for the class. Otherwise, a local error
code is returned.
Declaration
public LdapStatusCode ResultCode { get; }
Property Value
Type | Description |
---|---|
LdapStatusCode | The result code. |
Methods
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |