fix: Expose worker errors with stack trace

This commit is contained in:
Faruk AYDIN
2023-04-07 18:16:08 +02:00
parent 20c5d6aee1
commit 4aa41773c4
5 changed files with 50 additions and 28 deletions

View File

@@ -29,14 +29,17 @@ worker.on('completed', (job) => {
});
worker.on('failed', (job, err) => {
logger.info(
`JOB ID: ${job.id} - ${job.data.subject} email to ${job.data.email} has failed to send with ${err.message}`
);
const errorMessage = `
JOB ID: ${job.id} - ${job.data.subject} email to ${job.data.email} has failed to send with ${err.message}
\n ${err.stack}
`;
logger.error(errorMessage);
Sentry.captureException(err, {
extra: {
jobId: job.id,
}
},
});
});