[GH-ISSUE #565] [FEATURE REQUEST] Custom worker error handling #2295

Closed
opened 2026-03-15 19:59:36 +03:00 by kerem · 0 comments
Owner

Originally created by @endigma on GitHub (Oct 25, 2022).
Original GitHub issue: https://github.com/hibiken/asynq/issues/565

Originally assigned to: @hibiken on GitHub.

Is your feature request related to a problem? Please describe.
When tasks fail, they are documented to return error, these errors then get put in redis next to the retry. It would be nice if we could hook into this return process and execute custom "middleware" on returned errors (sentry, logging, etc).

Describe the solution you'd like
A function like func HandleErr(err error) error that is run as "middleware" when a worker returns an error.

Describe alternatives you've considered
Of course you can just log all the errors manually before returning them, but this decentralizes management of these errors and would require dragging a sentry/log client through many functions.

Originally created by @endigma on GitHub (Oct 25, 2022). Original GitHub issue: https://github.com/hibiken/asynq/issues/565 Originally assigned to: @hibiken on GitHub. **Is your feature request related to a problem? Please describe.** When tasks fail, they are documented to return `error`, these errors then get put in redis next to the retry. It would be nice if we could hook into this return process and execute custom "middleware" on returned errors (sentry, logging, etc). **Describe the solution you'd like** A function like `func HandleErr(err error) error` that is run as "middleware" when a worker returns an error. **Describe alternatives you've considered** Of course you can just log all the errors manually before returning them, but this decentralizes management of these errors and would require dragging a sentry/log client through many functions.
kerem 2026-03-15 19:59:36 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asynq#2295
No description provided.