Skip to content

Commit

Permalink
feat(queue_event_handlers): report failed job's error on Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
toverux committed Jun 26, 2017
1 parent 271d808 commit c4332e3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/converter/queue_event_handlers.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as raven from 'raven';
import config from '../config';
import logger from '../logger';
import { safeErrorSerialize } from '../safe_error_serialize';
import { IConversionJob, IProgressReportJob, updateConversion } from './job';
Expand Down Expand Up @@ -66,13 +68,20 @@ export async function onJobCompleted(job: IConversionJob, assetBundleUrl: string
}

export async function onJobFailed(job: IConversionJob, error: any): Promise<void> {
//=> Log & report on Sentry
logger.error(`convqueue: job #${job.jobId} has failed!`, error);

if (config.ravenDsn) {
raven.captureException(error);
}

//=> Report in job's progress log
const progressTask = job.progress(queueConversionEndedEvent(
'Conversion failed, an error occured!', null, error
));

// we don't update conversion.step to let the client know where the fail occured
//=> Update the conversion document infos about progress.
// We don't update conversion.step to let the client know where the fail occured.
const updateTask = updateConversion(job, {
$set: {
'conversion.isCompleted': true,
Expand Down

0 comments on commit c4332e3

Please sign in to comment.