Handle externalldap errors correctly in settings route

This commit is contained in:
Johannes Zellner
2019-08-29 13:15:18 +02:00
parent f61e9c7f27
commit 6db078c26a
2 changed files with 5 additions and 3 deletions

View File

@@ -83,7 +83,7 @@ function testConfig(config, callback) {
client = ldap.createClient({ url: config.url });
} catch (e) {
if (e instanceof ldap.ProtocolError) return callback(new ExternalLdapError(ExternalLdapError.BAD_FIELD, 'url protocol is invalid'));
return callback(new ExternalLdapError(ExternalLdapError.INTERNAL_ERROR, e));
return callback(new ExternalLdapError(ExternalLdapError.EXTERNAL_ERROR, e));
}
if (!config.bindDn) return callback(null, client);