I've noticed that bull does not print exceptions to the console by default. To get around this I want to catch errors with the @OnQuerueError
decorator and print them to the console (for now). My current implementation does not work and I don't understand why. The handler
is not called. I verified that other event listeners work such as @OnQueueActive()
:
@Processor('email')
export default class DigestEmailProcessor {
constructor(
) {}
@OnQueueError()
handler() {
console.log('fired exception');
}
@Process(PROCESS_NAMES.email.send)
async send(job: Job<JobData>) {
throw new Error("Foo bar")
}
}
The event listener
@OnQueueError()
is not correct for this use case. Try using the event listener@OnQueueFailed()
this raises an event for jobs that have thrown an error.using your example code:
more information on the different event listeners