MCPcopy
hub / github.com/riverqueue/river / ErrorHandler

Interface ErrorHandler

error_handler.go:12–28  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
12type 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
30type ErrorHandlerResult struct {
31 // SetCancelled can be set to true to fail the job immediately and

Callers

nothing calls this directly

Implementers 5

testErrorHandlererror_handler_test.go
CustomErrorHandlerexample_error_handler_test.go
testErrorHandlerinternal/jobexecutor/job_executor_test
errorHandlerWrapperrivertest/worker.go

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…