ErrorHandler provides an interface that will be invoked in case of an error or panic occurring in the job. This is often useful for logging and exception tracking, but can also be used to customize retry behavior.
| 10 | // or panic occurring in the job. This is often useful for logging and exception |
| 11 | // tracking, but can also be used to customize retry behavior. |
| 12 | type ErrorHandler interface { |
| 13 | // HandleError is invoked in case of an error occurring in a job. |
| 14 | // |
| 15 | // Context is descended from the one used to start the River client that |
| 16 | // worked the job. Errors are handled above all middleware, so changes made |
| 17 | // to context by a middleware are not available in the context. |
| 18 | HandleError(ctx context.Context, job *rivertype.JobRow, err error) *ErrorHandlerResult |
| 19 | |
| 20 | // HandlePanic is invoked in case of a panic occurring in a job. |
| 21 | // |
| 22 | // Context is descended from the one used to start the River client that |
| 23 | // worked the job. Panics are handled above all middleware, so changes made |
| 24 | // to context by a middleware are not available in the context (however, |
| 25 | // panics can be recovered from in any middleware where middleware context |
| 26 | // is available). |
| 27 | HandlePanic(ctx context.Context, job *rivertype.JobRow, panicVal any, trace string) *ErrorHandlerResult |
| 28 | } |
| 29 | |
| 30 | type ErrorHandlerResult struct { |
| 31 | // SetCancelled can be set to true to fail the job immediately and |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…