Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[LDAP] Add error codes to exceptions #28677

Copy link
Copy link
Closed
@shanept

Description

@shanept
Issue body actions

Description
Upon LDAP errors, the PHP ldap extension may also return an error code. Using this code may provide a friendlier way to determine the root cause of an issue than to interpret the error message - consider how the following example may be achieved currently, with the LDAP component.

Example

$ldap = Ldap::create('ext_ldap', [...]);

try {
    $ldap->bind('invalid_user', 'invalid_password');
} catch (ConnectionException $ex) {
    switch ($ex->getCode()) {
        case INVALID_CREDENTIALS:
            $message = 'Invalid Username or Password.';
            break;
        case CONNECTION_TIMEOUT:
            $message = 'Unable to connect to server.';
            break;
        ...
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.