You are here

public function SimpleLdapException::__construct in Simple LDAP 8

Constructs a SimpleLdapException.

File

src/SimpleLdapException.php, line 9

Class

SimpleLdapException

Namespace

Drupal\simple_ldap

Code

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

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

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