Remove various uses of INTERNAL_ERROR

INTERNAL_ERROR now means there really was some internal error
This commit is contained in:
Girish Ramakrishnan
2019-10-24 18:32:33 -07:00
parent 6e57f8cc03
commit ad9097d212
9 changed files with 19 additions and 21 deletions

View File

@@ -80,7 +80,7 @@ function verifyPassword(user, password, callback) {
assert.strictEqual(typeof callback, 'function');
settings.getExternalLdapConfig(function (error, externalLdapConfig) {
if (error) return callback(new BoxError(BoxError.INTERNAL_ERROR, error));
if (error) return callback(error);
if (!externalLdapConfig.enabled) return callback(new BoxError(BoxError.BAD_STATE, 'not enabled'));
getClient(externalLdapConfig, function (error, client) {
@@ -102,11 +102,11 @@ function startSyncer(callback) {
assert.strictEqual(typeof callback, 'function');
settings.getExternalLdapConfig(function (error, externalLdapConfig) {
if (error) return callback(new BoxError(BoxError.INTERNAL_ERROR, error));
if (error) return callback(error);
if (!externalLdapConfig.enabled) return callback(new BoxError(BoxError.BAD_STATE, 'not enabled'));
tasks.add(tasks.TASK_SYNC_EXTERNAL_LDAP, [], function (error, taskId) {
if (error) return callback(new BoxError(BoxError.INTERNAL_ERROR, error));
if (error) return callback(error);
tasks.startTask(taskId, {}, function (error, result) {
debug('sync: done', error, result);
@@ -124,7 +124,7 @@ function sync(progressCallback, callback) {
debug('Start user syncing ...');
settings.getExternalLdapConfig(function (error, externalLdapConfig) {
if (error) return callback(new BoxError(BoxError.INTERNAL_ERROR, error));
if (error) return callback(error);
if (!externalLdapConfig.enabled) return callback(new BoxError(BoxError.BAD_STATE, 'not enabled'));
getClient(externalLdapConfig, function (error, client) {