add check for failed status and complete time

This commit is contained in:
2016-05-02 14:31:14 -07:00
parent a143092e64
commit 60d486b804
2 changed files with 11 additions and 11 deletions

View File

@@ -131,14 +131,14 @@ export default class Job extends events.EventEmitter {
if (err.statusCode === 409) return false;
throw err;
});
}, (err) => {
}, (jobErr) => {
const completedTime = moment().toISOString();
const doc = {
status: jobStatuses.JOB_STATUS_FAILED,
completed_at: completedTime,
output: {
content_type: false,
content: err.toString()
content: jobErr.toString()
}
};
@@ -150,7 +150,7 @@ export default class Job extends events.EventEmitter {
body: { doc }
})
.catch(() => false)
.then(() => { throw err; });
.then(() => { throw jobErr; });
});
}