Typo in error handling

This commit is contained in:
Girish Ramakrishnan
2019-09-03 15:55:57 -07:00
parent de1e218ce9
commit 57fa457596

View File

@@ -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);
}
});