emit job fail events, don't throw

This commit is contained in:
2016-05-03 11:35:09 -07:00
parent 552abb7ddd
commit f725824c5f

View File

@@ -159,16 +159,13 @@ export default class Job extends events.EventEmitter {
// job execution failed // job execution failed
if (jobErr.type === 'WorkerTimeout') { if (jobErr.type === 'WorkerTimeout') {
this.debug(`Timeout on job ${job._id}`); this.debug(`Timeout on job ${job._id}`);
this.emit('job_timeout', jobErr);
return; return;
} }
this.debug(`Failure occurred on job ${job._id}`); this.debug(`Failure occurred on job ${job._id}`);
return this._failJob(job, jobErr.toString()) this.emit('job_error', jobErr);
.catch(() => false) return this._failJob(job, jobErr.toString());
.then(() => {
this.emit('job_error', jobErr);
throw jobErr;
});
}); });
} }