diff --git a/processor.go b/processor.go index 35960fa..6a97178 100644 --- a/processor.go +++ b/processor.go @@ -203,6 +203,9 @@ func (p *processor) exec() { return case <-ctx.Done(): p.logger.Debugf("Retrying task. task id=%s", msg.ID) // TODO: Improve this log message and above + if p.errHandler != nil { + p.errHandler.HandleError(ctx, task, ctx.Err()) + } p.retryOrKill(ctx, msg, ctx.Err()) return case resErr := <-resCh: diff --git a/server.go b/server.go index d52e2fa..3fc8998 100644 --- a/server.go +++ b/server.go @@ -125,7 +125,7 @@ type Config struct { ShutdownTimeout time.Duration } -// An ErrorHandler handles errors returned by the task handler. +// An ErrorHandler handles an error occured during task processing. type ErrorHandler interface { HandleError(ctx context.Context, task *Task, err error) }