Skip to content

Commit

Permalink
attempting to start non existing jobs will now error correctly resolves
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnoble committed Sep 28, 2017
1 parent df3fab7 commit 28075a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/cluster/services/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ module.exports = function(context, app, services) {
.catch(function(err) {
var errMsg = parseError(err);
logger.error(`Error: could not start job: ${errMsg}`);
sendError(res, 500, `Could not start job: ${job_id}`);
sendError(res, 500, `Could not start job: ${job_id}, error: ${errMsg}`);
});
}
})
.catch(function(err) {
var errMsg = parseError(err);
logger.error(errMsg);
sendError(res, 500, errMsg)
sendError(res, 500, errMsg);
})
});

Expand Down
6 changes: 5 additions & 1 deletion lib/cluster/services/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,18 @@ module.exports = function(context, cluster_service) {
function startJob(job_id) {
return getJob(job_id)
.then(function(job_spec) {
if(!job_spec) {
return Promise.reject(`no job for job_id: ${job_id} could be found`);
}
return ensureAssets(job_spec);
})
.then(function(assetIdJob) {
return createExecutionContext(assetIdJob);
})
.catch(function(err) {
var errMsg = parseError(err);
logger.error(`could not startJob`, errMsg)
logger.error(`could not startJob`, errMsg);
return Promise.reject(errMsg);
});
}

Expand Down

0 comments on commit 28075a1

Please sign in to comment.