tasker: add support for reporting panics

This commit is contained in:
Mohamed Sohail 2023-03-14 15:45:06 +00:00
parent b8ebf88f36
commit f4e3aedf33
Signed by: kamikazechaser
GPG Key ID: 7DD45520C01CD85D

View File

@ -72,6 +72,8 @@ func observibilityMiddleware() asynq.MiddlewareFunc {
err := handler.ProcessTask(ctx, task)
if err != nil && isFailureHandler(err) {
lo.Error("tasker: handler error", "err", err, "task_type", task.Type(), "task_id", taskId)
} else if asynq.IsPanicError(err) {
lo.Error("tasker: handler panic", "err", err, "task_type", task.Type(), "task_id", taskId)
} else {
lo.Info("tasker: process task", "task_type", task.Type(), "task_id", taskId)
}