pub struct ErrorHandler;Expand description
Handles step execution errors and applies error actions
Responsible for:
- Catching step execution errors
- Applying error actions (retry, skip, fail, rollback)
- Tracking error history
- Managing retry logic with exponential backoff
Implementations§
Source§impl ErrorHandler
impl ErrorHandler
Sourcepub fn handle_error(
workflow: &Workflow,
state: &mut WorkflowState,
step_id: &str,
error: String,
) -> WorkflowResult<bool>
pub fn handle_error( workflow: &Workflow, state: &mut WorkflowState, step_id: &str, error: String, ) -> WorkflowResult<bool>
Handle a step execution error
Applies the specified error action and updates the workflow state accordingly. Returns true if the workflow should continue, false if it should stop.
Sourcepub fn should_retry(workflow: &Workflow, step_id: &str) -> bool
pub fn should_retry(workflow: &Workflow, step_id: &str) -> bool
Check if a step should be retried
Sourcepub fn get_retry_config(
workflow: &Workflow,
step_id: &str,
) -> Option<(usize, u64)>
pub fn get_retry_config( workflow: &Workflow, step_id: &str, ) -> Option<(usize, u64)>
Get retry configuration for a step
Sourcepub fn should_skip_on_error(workflow: &Workflow, step_id: &str) -> bool
pub fn should_skip_on_error(workflow: &Workflow, step_id: &str) -> bool
Check if a step should be skipped on error
Sourcepub fn should_rollback_on_error(workflow: &Workflow, step_id: &str) -> bool
pub fn should_rollback_on_error(workflow: &Workflow, step_id: &str) -> bool
Check if a step should rollback on error
Sourcepub fn get_error_action(
workflow: &Workflow,
step_id: &str,
) -> Option<ErrorAction>
pub fn get_error_action( workflow: &Workflow, step_id: &str, ) -> Option<ErrorAction>
Get the error action for a step
Sourcepub fn capture_error(
state: &mut WorkflowState,
step_id: &str,
error_type: &str,
error_message: &str,
stack_trace: Option<&str>,
) -> WorkflowResult<()>
pub fn capture_error( state: &mut WorkflowState, step_id: &str, error_type: &str, error_message: &str, stack_trace: Option<&str>, ) -> WorkflowResult<()>
Capture error details in step result
Stores error type, message, and stack trace in the step result.
Sourcepub fn get_error_details(state: &WorkflowState, step_id: &str) -> Option<String>
pub fn get_error_details(state: &WorkflowState, step_id: &str) -> Option<String>
Get error details from a step result
Sourcepub fn has_error(state: &WorkflowState, step_id: &str) -> bool
pub fn has_error(state: &WorkflowState, step_id: &str) -> bool
Check if a step has an error
Sourcepub fn get_all_errors(state: &WorkflowState) -> Vec<(String, String)>
pub fn get_all_errors(state: &WorkflowState) -> Vec<(String, String)>
Get all errors in the workflow
Auto Trait Implementations§
impl Freeze for ErrorHandler
impl RefUnwindSafe for ErrorHandler
impl Send for ErrorHandler
impl Sync for ErrorHandler
impl Unpin for ErrorHandler
impl UnwindSafe for ErrorHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more