ErrorHandler

Struct ErrorHandler 

Source
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

Source

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.

Source

pub fn should_retry(workflow: &Workflow, step_id: &str) -> bool

Check if a step should be retried

Source

pub fn get_retry_config( workflow: &Workflow, step_id: &str, ) -> Option<(usize, u64)>

Get retry configuration for a step

Source

pub fn should_skip_on_error(workflow: &Workflow, step_id: &str) -> bool

Check if a step should be skipped on error

Source

pub fn should_rollback_on_error(workflow: &Workflow, step_id: &str) -> bool

Check if a step should rollback on error

Source

pub fn get_error_action( workflow: &Workflow, step_id: &str, ) -> Option<ErrorAction>

Get the error action for a step

Source

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.

Source

pub fn get_error_details(state: &WorkflowState, step_id: &str) -> Option<String>

Get error details from a step result

Source

pub fn has_error(state: &WorkflowState, step_id: &str) -> bool

Check if a step has an error

Source

pub fn get_all_errors(state: &WorkflowState) -> Vec<(String, String)>

Get all errors in the workflow

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.