pub trait OnErrorAction:
Send
+ Sync
+ Debug {
// Required method
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
error: &'life1 Error,
task_id: TaskId,
attempt_count: u32,
context: &'life2 TaskExecutionContext,
) -> Pin<Box<dyn Future<Output = ActionResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Expand description
Trait for implementing custom error handling actions
This provides full access to the task execution context for complex error handling scenarios that don’t fit into the built-in response patterns.
Required Methods§
Sourcefn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
error: &'life1 Error,
task_id: TaskId,
attempt_count: u32,
context: &'life2 TaskExecutionContext,
) -> Pin<Box<dyn Future<Output = ActionResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
error: &'life1 Error,
task_id: TaskId,
attempt_count: u32,
context: &'life2 TaskExecutionContext,
) -> Pin<Box<dyn Future<Output = ActionResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Execute custom error handling logic
§Arguments
error- The error that caused the task to failtask_id- Unique identifier of the failed taskattempt_count- Number of times this task has been attempted (starts at 1)context- Full execution context with access to scheduler, metrics, etc.
§Returns
ActionResult indicating what the TaskTracker should do next
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".