Move BackupsError to BoxError

This commit is contained in:
Girish Ramakrishnan
2019-10-22 20:36:20 -07:00
parent df142994a8
commit 8c9ce30d29
9 changed files with 132 additions and 145 deletions
+1 -4
View File
@@ -91,7 +91,6 @@ exports = module.exports = {
var addons = require('./addons.js'),
assert = require('assert'),
backups = require('./backups.js'),
BackupsError = backups.BackupsError,
BoxError = require('./boxerror.js'),
constants = require('./constants.js'),
cron = require('./cron.js'),
@@ -352,9 +351,7 @@ function setBackupConfig(backupConfig, callback) {
backups.injectPrivateFields(backupConfig, curentConfig);
backups.testConfig(backupConfig, function (error) {
if (error && error.reason === BackupsError.BAD_FIELD) return callback(new BoxError(BoxError.BAD_FIELD, error.message));
if (error && error.reason === BackupsError.EXTERNAL_ERROR) return callback(new BoxError(BoxError.EXTERNAL_ERROR, error.message));
if (error) return callback(new BoxError(BoxError.DATABASE_ERROR, error));
if (error) return callback(error);
backups.cleanupCacheFilesSync();