You are here

public function SimpleLdapException::__construct in Simple LDAP 7.2

Same name and namespace in other branches
  1. 7 SimpleLdapException.class.php \SimpleLdapException::__construct()

Inherited __construct().

File

./SimpleLdapException.class.php, line 12
Class to handle Simple LDAP exceptions.

Class

SimpleLdapException
@file Class to handle Simple LDAP exceptions.

Code

public function __construct($resource) {
  if (is_resource($resource)) {

    // Handle LDAP operation errors.
    $error = ldap_errno($resource);
    $message = ldap_err2str($error);
    parent::__construct($message, $error);
  }
  else {

    // Handle exceptions that are not related to an LDAP resource link.
    parent::__construct($resource);
  }

  // Log the exception.
  watchdog_exception('simple_ldap', $this);
}