pub trait ErrorHandler: Send + Sync {
// Required method
fn handle(
&self,
name: &str,
error_msg: &str,
cycle: u64,
duration_nanos: u64,
detail: ErrorDetail,
) -> ErrorDetail;
}Expand description
A single error handler in the chain.
Each handler can:
- Perform side effects (logging, counting, metering)
- Transform the
ErrorDetail(mark as retryable, change result code) - Halt execution (by panicking or returning a stop signal)
Handlers are composable: the chain passes ErrorDetail through
each handler in sequence.
Required Methods§
Sourcefn handle(
&self,
name: &str,
error_msg: &str,
cycle: u64,
duration_nanos: u64,
detail: ErrorDetail,
) -> ErrorDetail
fn handle( &self, name: &str, error_msg: &str, cycle: u64, duration_nanos: u64, detail: ErrorDetail, ) -> ErrorDetail
Handle an error, returning a potentially transformed ErrorDetail.
name: error classification name (type name or custom)error_msg: the error messagecycle: the cycle number that was executingduration_nanos: how long into the operation the error occurreddetail: the current ErrorDetail from upstream handlers
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".