Return correct error code when already locked

This commit is contained in:
Girish Ramakrishnan
2019-01-17 10:58:34 -08:00
parent a7fe35513a
commit a915348b22
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -190,7 +190,7 @@ function updateToLatest(auditSource, callback) {
if (!boxUpdateInfo.sourceTarballUrl) return callback(new UpdaterError(UpdaterError.BAD_STATE, 'No automatic update available'));
let error = locker.lock(locker.OP_BOX_UPDATE);
if (error) return callback(error);
if (error) return callback(new UpdaterError(UpdaterError.BAD_STATE, `Cannot update now: ${error.message}`));
let task = tasks.startTask(tasks.TASK_UPDATE, [ boxUpdateInfo ]);
task.on('error', (error) => callback(new UpdaterError(UpdaterError.INTERNAL_ERROR, error)));