Table of Contents | Previous | Next | Index

Netscape Directory SDK 3.0 for C Programmer’s Guide
     Chapter 18 Functions

ldap_set_lderrno()

The ldap_set_lderrno() function sets an error code and information about an error in an LDAP structure. You can call this function to set error information that will be retrieved by subsequent ldap_get_lderrno() function calls.

For more information, see "Setting Error Codes" on page 79.

Syntax

#include <ldap.h>
int ldap_set_lderrno( LDAP *ld, int e, char *m, char *s );

Parameters

This function has the following parameters:

ld

Connection handle, which is a pointer to an LDAP structure containing information about the connection to the LDAP server.

e

The error code that you want to set.

m

In the event that an entry for a specified DN cannot be found , you should set this parameter to the portion of the DN that identifies an existing entry. (See "Receiving the Portion of the DN Matching an Entry" on page 73 for details.)

s

The text of the error message that you want associated with this error code.

Returns

One of the following values:

Example

The following section of code attempts to perform an operation. If the operation fails, the LDAP_PARAM_ERROR error code is placed in the LDAP structure.

#include <ldap.h>
int rc;
char *errmsg = "Invalid parameter";
...
if ( ldap_my_function() != LDAP_SUCCESS ) {
   rc = ldap_set_lderrno( ld, LDAP_PARAM_ERROR, NULL, errmsg );
   if ( rc != LDAP_SUCCESS ) {
      printf( "Error: %d\nError code could not be set.\n", rc );
   }
   return( rc );
}
...

See Also

ldap_err2string(), ldap_perror(), ldap_result2error().


Table of Contents | Previous | Next | Index

Last Updated: 10/01/98 17:06:23