Move ExternalLdapError to BoxError
This commit is contained in:
+1
-5
@@ -102,7 +102,6 @@ var addons = require('./addons.js'),
|
||||
debug = require('debug')('box:settings'),
|
||||
docker = require('./docker.js'),
|
||||
externalldap = require('./externalldap.js'),
|
||||
ExternalLdapError = externalldap.ExternalLdapError,
|
||||
moment = require('moment-timezone'),
|
||||
paths = require('./paths.js'),
|
||||
safe = require('safetydance'),
|
||||
@@ -414,10 +413,7 @@ function setExternalLdapConfig(externalLdapConfig, callback) {
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
externalldap.testConfig(externalLdapConfig, function (error) {
|
||||
if (error && error.reason === ExternalLdapError.BAD_FIELD) return callback(new BoxError(BoxError.BAD_FIELD, error.message));
|
||||
if (error && error.reason === ExternalLdapError.EXTERNAL_ERROR) return callback(new BoxError(BoxError.EXTERNAL_ERROR, error.message));
|
||||
if (error && error.reason === ExternalLdapError.INVALID_CREDENTIALS) return callback(new BoxError(BoxError.BAD_FIELD, 'invalid bind credentials'));
|
||||
if (error) return callback(new BoxError(BoxError.DATABASE_ERROR, error));
|
||||
if (error) return callback(error);
|
||||
|
||||
settingsdb.set(exports.EXTERNAL_LDAP_KEY, JSON.stringify(externalLdapConfig), function (error) {
|
||||
if (error) return callback(error);
|
||||
|
||||
Reference in New Issue
Block a user