diff --git a/src/apps.js b/src/apps.js index 071d7fd81..4df7e2b44 100644 --- a/src/apps.js +++ b/src/apps.js @@ -644,11 +644,11 @@ function scheduleTask(appId, args, values, callback) { appTaskManager.scheduleTask(appId, taskId, function (error) { debug(`scheduleTask: task ${taskId} of $${appId} completed`); - if (error && (error.crashed || error.stopped)) { + if (error && (error.code === tasks.ECRASHED || error.code === tasks.ESTOPPED)) { // if task crashed, update the error debug(`Apptask crashed/stopped: ${error.message}`); const code = error.crashed ? exports.ETASK_CRASHED : exports.ETASK_STOPPED; appdb.update(appId, { installationState: exports.ISTATE_ERROR, error: { code: code, message: error.message }, taskId: null }, NOOP_CALLBACK); - } else if (values.installationState !== exports.ISTATE_PENDING_UNINSTALL) { + } else if (values.installationState !== exports.ISTATE_PENDING_UNINSTALL) { // clear out taskId since it's done appdb.update(appId, { taskId: null }, NOOP_CALLBACK); } });