Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return async (context) => {
context.sentry = new Sentry.Hub(Sentry.getCurrentHub().getClient())
context.sentry.configureScope(scope => scope.addEventProcessor(AxiosErrorEventDecorator.decorate))
context.sentry.configureScope(scope => scope.addEventProcessor(SentryScopeProxy.processEvent))
try {
await callback(context)
} catch (err) {
context.sentry.captureException(err)
throw err
}
}
}
return async (job) => {
job.sentry = new Sentry.Hub(Sentry.getCurrentHub().getClient())
job.sentry.configureScope(scope => scope.addEventProcessor(AxiosErrorEventDecorator.decorate))
job.sentry.configureScope(scope => scope.addEventProcessor(SentryScopeProxy.processEvent))
try {
await jobHandler(job)
} catch (err) {
job.sentry.setExtra('job', {
id: job.id,
attemptsMade: job.attemptsMade,
timestamp: new Date(job.timestamp),
data: job.data
})
job.sentry.setTag('jiraHost', job.data.jiraHost)
job.sentry.setTag('queue', job.queue.name)
job.sentry.captureException(err)