Improve external ldap error reporting

This commit is contained in:
Johannes Zellner
2019-08-29 14:28:15 +02:00
parent 5431d50206
commit 4d3948f81f

View File

@@ -87,7 +87,7 @@ function testConfig(config, callback) {
}
function bindIfNeeded(callback) {
if (!config.bindDn) return callback(null, client);
if (!config.bindDn) return callback();
client.bind(config.bindDn, config.bindPassword, function (error) {
if (error instanceof ldap.InvalidCredentialsError) return callback(new ExternalLdapError(ExternalLdapError.INVALID_CREDENTIALS));
@@ -106,6 +106,7 @@ function testConfig(config, callback) {
};
client.search(config.baseDn, opts, function (error, result) {
console.error('---', error)
if (error) return callback(new ExternalLdapError(ExternalLdapError.EXTERNAL_ERROR, error));
result.on('searchEntry', function (entry) {});