tasks.get returns null on not found

This commit is contained in:
Girish Ramakrishnan
2021-07-14 10:59:49 -07:00
parent e59d0e878d
commit ac70350531
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -30,6 +30,7 @@ async function get(req, res, next) {
const [error, task] = await safe(tasks.get(req.params.taskId));
if (error) return next(BoxError.toHttpError(error));
if (!task) return next(new HttpError(404, 'task not found'));
next(new HttpSuccess(200, tasks.removePrivateFields(task)));
}
+2 -2
View File
@@ -72,8 +72,8 @@ async.series([
debug(`Starting task ${taskId}. Logs are at ${logFile}`);
const [getError, task] = await safe(tasks.get(taskId));
if (getError) {
debug(getError);
if (getError || !task) {
debug(getError ? `Error getting task: ${getError.message}` : 'Task not found');
return process.exit(50);
}