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

@@ -771,7 +771,6 @@ function rotateBoxBackup(backupConfig, tag, appBackupIds, progressCallback, call
assert.strictEqual(typeof callback, 'function');
var snapshotInfo = getSnapshotInfo('box');
if (!snapshotInfo) return callback(new BoxError(BoxError.INTERNAL_ERROR, 'Snapshot info missing or corrupt'));
const snapshotTime = snapshotInfo.timestamp.replace(/[T.]/g, '-').replace(/[:Z]/g,''); // add this to filename to make it unique, so it's easy to download them
const backupId = util.format('%s/box_%s_v%s', tag, snapshotTime, constants.VERSION);
@@ -852,7 +851,6 @@ function rotateAppBackup(backupConfig, app, tag, options, progressCallback, call
assert.strictEqual(typeof callback, 'function');
var snapshotInfo = getSnapshotInfo(app.id);
if (!snapshotInfo) return callback(new BoxError(BoxError.INTERNAL_ERROR, 'Snapshot info missing or corrupt'));
var manifest = snapshotInfo.restoreConfig ? snapshotInfo.restoreConfig.manifest : snapshotInfo.manifest; // compat
const snapshotTime = snapshotInfo.timestamp.replace(/[T.]/g, '-').replace(/[:Z]/g,''); // add this for unique filename which helps when downloading them
@@ -951,7 +949,7 @@ function backupBoxAndApps(progressCallback, callback) {
const tag = (new Date()).toISOString().replace(/[T.]/g, '-').replace(/[:Z]/g,'');
apps.getAll(function (error, allApps) {
if (error) return callback(new BoxError(BoxError.INTERNAL_ERROR, error));
if (error) return callback(error);
let percent = 1;
let step = 100/(allApps.length+2);
@@ -993,7 +991,7 @@ function startBackupTask(auditSource, callback) {
if (error) return callback(new BoxError(BoxError.BAD_STATE, `Cannot backup now: ${error.message}`));
tasks.add(tasks.TASK_BACKUP, [ ], function (error, taskId) {
if (error) return callback(new BoxError(BoxError.INTERNAL_ERROR, error));
if (error) return callback(error);
eventlog.add(eventlog.ACTION_BACKUP_START, auditSource, { taskId });