C# Class Novell.Directory.Ldap.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. Five possible sources of information are available from LdapException:
Result Code:
The getResultCode method returns a result code, which can be compared against standard Ldap result codes.
Message:
The getMessage method returns a localized message from the message resource that corresponds to the result code.
Ldap server Message:
The getLdapErrorMessage method returns any error message received from the Ldap server.
Matched DN:
The getMatchedDN method retrieves the part of a submitted distinguished name which could be matched by the server
Root Cause:
The getCause method returns the a nested exception that was the original cause for the error.
The toString method returns a string containing all the above sources of information, if they have a value. Exceptions generated by the API, i.e. that are not a result of a server response, can be identified as instanceof {@link LdapLocalException} The following table lists the standard Ldap result codes. See RFC2251 for a discussion of the meanings of the result codes. The corresponding ASN.1 definition from RFC2251 is provided in parentheses.
Value Result Code
0{@link #SUCCESS} (success)
1{@link #OPERATIONS_ERROR} (operationsError)
2{@link #PROTOCOL_ERROR} (protocolError)
3{@link #TIME_LIMIT_EXCEEDED} (timeLimitExceeded)
4{@link #SIZE_LIMIT_EXCEEDED} (sizeLimitExceeded)
5{@link #COMPARE_FALSE} (compareFalse)
6{@link #COMPARE_TRUE} (compareTrue)
7{@link #AUTH_METHOD_NOT_SUPPORTED} (authMethodNotSupported)
8{@link #STRONG_AUTH_REQUIRED} (strongAuthRequired)
10{@link #REFERRAL} (referral)
11{@link #ADMIN_LIMIT_EXCEEDED} (adminLimitExceeded)
12{@link #UNAVAILABLE_CRITICAL_EXTENSION} (unavailableCriticalExtension)
13{@link #CONFIDENTIALITY_REQUIRED} (confidentialityRequired)
14{@link #SASL_BIND_IN_PROGRESS} (saslBindInProgress)
16{@link #NO_SUCH_ATTRIBUTE} (noSuchAttribute)
17{@link #UNDEFINED_ATTRIBUTE_TYPE} (undefinedAttributeType)
18{@link #INAPPROPRIATE_MATCHING} (inappropriateMatching)
19{@link #CONSTRAINT_VIOLATION} (constraintViolation)
20{@link #ATTRIBUTE_OR_VALUE_EXISTS} (AttributeOrValueExists)
21{@link #INVALID_ATTRIBUTE_SYNTAX} (invalidAttributeSyntax)
32{@link #NO_SUCH_OBJECT} (noSuchObject)
33{@link #ALIAS_PROBLEM} (aliasProblem)
34{@link #INVALID_DN_SYNTAX} (invalidDNSyntax)
35{@link #IS_LEAF} (isLeaf)
36{@link #ALIAS_DEREFERENCING_PROBLEM} (aliasDereferencingProblem)
48{@link #INAPPROPRIATE_AUTHENTICATION} (inappropriateAuthentication)
49{@link #INVALID_CREDENTIALS} (invalidCredentials)
50{@link #INSUFFICIENT_ACCESS_RIGHTS} (insufficientAccessRights)
51{@link #BUSY} (busy)
52{@link #UNAVAILABLE} (unavailable)
53{@link #UNWILLING_TO_PERFORM} (unwillingToPerform)
54{@link #LOOP_DETECT} (loopDetect)
64{@link #NAMING_VIOLATION} (namingViolation)
65{@link #OBJECT_CLASS_VIOLATION} (objectClassViolation)
66{@link #NOT_ALLOWED_ON_NONLEAF} (notAllowedOnNonLeaf)
67{@link #NOT_ALLOWED_ON_RDN} (notAllowedOnRDN)
68{@link #ENTRY_ALREADY_EXISTS} (entryAlreadyExists)
69{@link #OBJECT_CLASS_MODS_PROHIBITED} (objectClassModsProhibited)
71{@link #AFFECTS_MULTIPLE_DSAS} (affectsMultipleDSAs
80{@link #OTHER} (other)
Local errors, resulting from actions other than an operation on a server.
Value Result Code
81{@link #SERVER_DOWN}
82{@link #LOCAL_ERROR}
83{@link #ENCODING_ERROR}
84{@link #DECODING_ERROR}
85{@link #Ldap_TIMEOUT}
86{@link #AUTH_UNKNOWN}
87{@link #FILTER_ERROR}
88{@link #USER_CANCELLED}
90{@link #NO_MEMORY}
91{@link #CONNECT_ERROR}
92{@link #Ldap_NOT_SUPPORTED}
93{@link #CONTROL_NOT_FOUND}
94{@link #NO_RESULTS_RETURNED}
95{@link #MORE_RESULTS_TO_RETURN}
96{@link #CLIENT_LOOP}
97{@link #REFERRAL_LIMIT_EXCEEDED}
100{@link #INVALID_RESPONSE}
101{@link #AMBIGUOUS_RESPONSE}
112{@link #TLS_NOT_SUPPORTED}
Inheritance: System.Exception
显示文件 Open project: EventStore/csharp-ldap Class Usage Examples

Public Methods

Method Description
LdapException ( ) : System

Constructs a default exception with no specific error information.

LdapException ( System messageOrKey, System arguments, int resultCode, System serverMsg ) : System

Constructs an exception with a detailed message obtained from the specified MessageOrKey String and modifying arguments. Additional parameters specify the result code and server message. The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself. The message in the default locale is built with the supplied arguments, which are saved to be used for building messages for other locales.

LdapException ( System messageOrKey, System arguments, int resultCode, System serverMsg, System rootException ) : System

Constructs an exception with a detailed message obtained from the specified MessageOrKey String and modifying arguments. Additional parameters specify the result code, the server message, and a rootException which is the underlying cause of an error on the client. The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself. The message in the default locale is built with the supplied arguments, which are saved to be used for building messages for other locales.

LdapException ( System messageOrKey, int resultCode, System serverMsg ) : System

Constructs an exception with a detailed message obtained from the specified MessageOrKey String, the result code, and a server meessage. The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself.

LdapException ( System messageOrKey, int resultCode, System serverMsg, System rootException ) : System

Constructs an exception with a detailed message obtained from the specified MessageOrKey String. Additional parameters specify the result code, the server message, and a rootException which is the underlying cause of an error on the client. The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself.

ToString ( ) : System.String

returns a string of information about the exception and the the nested exceptions, if any.

resultCodeToString ( ) : System.String

Returns a string representing the result code in the default locale.

resultCodeToString ( System locale ) : System.String

Returns a string representing the result code in the specified locale.

resultCodeToString ( int code ) : System.String

Returns a string representing the specified result code in the default locale.

resultCodeToString ( int code, System locale ) : System.String

Returns a string representing the specified error code in the specified locale.

Private Methods

Method Description
LdapException ( System messageOrKey, System arguments, int resultCode, System serverMsg, System matchedDN, System rootException ) : System

Constructs an exception with a detailed message obtained from the specified MessageOrKey String and modifying arguments. Additional parameters specify the result code, a message returned from the server, a matchedDN returned from the server, and a rootException which is the underlying cause of an error on the client. The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself. The message in the default locale is built with the supplied arguments, which are saved to be used for building messages for other locales.

getExceptionString ( System exception ) : System.String

builds a string of information about the exception and the the nested exceptions, if any.

Method Details

LdapException() public method

Constructs a default exception with no specific error information.
public LdapException ( ) : System
return System

LdapException() public method

Constructs an exception with a detailed message obtained from the specified MessageOrKey String and modifying arguments. Additional parameters specify the result code and server message. The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself. The message in the default locale is built with the supplied arguments, which are saved to be used for building messages for other locales.
public LdapException ( System messageOrKey, System arguments, int resultCode, System serverMsg ) : System
messageOrKey System Key to addition result information, a key into /// ExceptionMessages, or the information /// itself if the key doesn't exist. /// ///
arguments System The modifying arguments to be included in the /// message string. /// ///
resultCode int The result code returned. ///
serverMsg System Error message specifying additional information /// from the server /// ///
return System

LdapException() public method

Constructs an exception with a detailed message obtained from the specified MessageOrKey String and modifying arguments. Additional parameters specify the result code, the server message, and a rootException which is the underlying cause of an error on the client. The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself. The message in the default locale is built with the supplied arguments, which are saved to be used for building messages for other locales.
public LdapException ( System messageOrKey, System arguments, int resultCode, System serverMsg, System rootException ) : System
messageOrKey System Key to addition result information, a key into /// ExceptionMessages, or the information /// itself if the key doesn't exist. /// ///
arguments System The modifying arguments to be included in the /// message string. /// ///
resultCode int The result code returned. /// ///
serverMsg System Error message specifying additional information /// from the server /// ///
rootException System A throwable which is the underlying cause /// of the LdapException. ///
return System

LdapException() public method

Constructs an exception with a detailed message obtained from the specified MessageOrKey String, the result code, and a server meessage. The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself.
public LdapException ( System messageOrKey, int resultCode, System serverMsg ) : System
messageOrKey System Key to addition result information, a key into /// ExceptionMessages, or the information /// itself if the key doesn't exist. /// ///
resultCode int The result code returned. /// ///
serverMsg System Error message specifying additional information /// from the server ///
return System

LdapException() public method

Constructs an exception with a detailed message obtained from the specified MessageOrKey String. Additional parameters specify the result code, the server message, and a rootException which is the underlying cause of an error on the client. The String is used either as a message key to obtain a localized messsage from ExceptionMessages, or if there is no key in the resource matching the text, it is used as the detailed message itself.
public LdapException ( System messageOrKey, int resultCode, System serverMsg, System rootException ) : System
messageOrKey System Key to addition result information, a key into /// ExceptionMessages, or the information /// itself if the key doesn't exist. /// ///
resultCode int The result code returned. /// ///
serverMsg System Error message specifying additional information /// from the server /// ///
rootException System A throwable which is the underlying cause /// of the LdapException. ///
return System

ToString() public method

returns a string of information about the exception and the the nested exceptions, if any.
public ToString ( ) : System.String
return System.String

resultCodeToString() public method

Returns a string representing the result code in the default locale.
public resultCodeToString ( ) : System.String
return System.String

resultCodeToString() public method

Returns a string representing the result code in the specified locale.
public resultCodeToString ( System locale ) : System.String
locale System The locale in which to render the error message. /// ///
return System.String

resultCodeToString() public static method

Returns a string representing the specified result code in the default locale.
public static resultCodeToString ( int code ) : System.String
code int The result code for which a message is to be returned. /// ///
return System.String

resultCodeToString() public static method

Returns a string representing the specified error code in the specified locale.
public static resultCodeToString ( int code, System locale ) : System.String
code int The result code for which a message is to be /// returned. /// ///
locale System The locale in which to render the message. /// ///
return System.String