CanoError

Enum CanoError 

Source
pub enum CanoError {
    NodeExecution(String),
    TaskExecution(String),
    Preparation(String),
    Store(String),
    Workflow(String),
    Configuration(String),
    RetryExhausted(String),
    Generic(String),
}
Expand description

Comprehensive error type for Cano workflows

This enum covers all the different ways things can go wrong in Cano workflows. Each variant is designed to give you clear information about what happened and how to fix it.

§🎯 Error Categories

§NodeExecution

Something went wrong in your node’s business logic during the exec phase.

Common causes:

  • Invalid input data
  • External API failures
  • Business rule violations
  • Resource unavailability

How to fix: Check your node’s exec method logic and input validation.

§Preparation

Something went wrong while preparing data in the prep phase.

Common causes:

  • Missing data in store
  • Invalid data format
  • Resource initialization failures

How to fix: Verify that previous nodes stored the expected data.

§store

store operations failed (get, put, remove, etc.).

Common causes:

  • Type mismatches when retrieving data
  • store backend issues
  • Concurrent access problems

How to fix: Check store keys and ensure type consistency.

§Workflow

Workflow orchestration problems.

Common causes:

  • Unregistered node references
  • Invalid action routing
  • Circular dependencies

How to fix: Verify node registration and action string routing.

§Configuration

Invalid node or workflow configuration.

Common causes:

  • Invalid concurrency settings
  • Negative retry counts
  • Conflicting settings

How to fix: Review node builder parameters and workflow setup.

§RetryExhausted

All retry attempts have been exhausted.

Common causes:

  • Persistent external failures
  • Insufficient retry configuration
  • Systemic issues

How to fix: Increase retry count, fix root cause, or add exponential backoff.

§💡 Usage Examples

Create specific error types with helpful messages. Use the appropriate error variant (NodeExecution, Configuration, store, etc.) and provide clear, actionable error messages that help users understand what went wrong.

§🔄 Converting from Other Errors

Cano errors can be created from various sources including standard library errors, string slices, and owned strings. Use the appropriate constructor method or the Into trait for convenient conversion.

Variants§

§

NodeExecution(String)

Error during node execution phase (your business logic)

Use this when your node’s exec method encounters an error in its core processing logic. Include specific details about what went wrong.

§

TaskExecution(String)

Error during task execution

Use this when your task’s run method encounters an error during execution. This is the task-specific equivalent of NodeExecution.

§

Preparation(String)

Error during node preparation phase (data loading/setup)

Use this when your node’s prep method fails to load or prepare data. Often indicates missing or invalid data in store.

§

Store(String)

Error in store operations (get/put/remove)

Use this for store-related failures like missing keys, type mismatches, or store backend issues.

§

Workflow(String)

Error in workflow orchestration (routing/registration)

Use this for workflow-level problems like unregistered nodes, invalid action routing, or workflow configuration issues.

§

Configuration(String)

Error in node or workflow configuration (invalid settings)

Use this for configuration problems like invalid parameters, conflicting settings, or constraint violations.

§

RetryExhausted(String)

All retry attempts have been exhausted

This error is automatically generated when a node fails and all configured retry attempts have been used up.

§

Generic(String)

General-purpose error for other scenarios

Use this for errors that don’t fit the other categories. Try to be specific in the error message.

Implementations§

Source§

impl CanoError

Source

pub fn node_execution<S: Into<String>>(msg: S) -> Self

Create a new node execution error

Source

pub fn task_execution<S: Into<String>>(msg: S) -> Self

Create a new task execution error

Source

pub fn preparation<S: Into<String>>(msg: S) -> Self

Create a new preparation error

Source

pub fn store<S: Into<String>>(msg: S) -> Self

Create a new store error

Source

pub fn workflow<S: Into<String>>(msg: S) -> Self

Create a new workflow error

Source

pub fn configuration<S: Into<String>>(msg: S) -> Self

Create a new configuration error

Source

pub fn retry_exhausted<S: Into<String>>(msg: S) -> Self

Create a new retry exhausted error

Source

pub fn generic<S: Into<String>>(msg: S) -> Self

Create a new generic error

Source

pub fn from_store_error(err: StoreError) -> Self

Convert a StoreError to a CanoError

This is a convenience method that explicitly converts store errors to workflow errors. The automatic From implementation also works.

Source

pub fn message(&self) -> &str

Get the error message as a string slice

Source

pub fn category(&self) -> &'static str

Get the error category as a string

Trait Implementations§

Source§

impl Clone for CanoError

Source§

fn clone(&self) -> CanoError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CanoError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for CanoError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for CanoError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<&str> for CanoError

Source§

fn from(err: &str) -> Self

Converts to this type from the input type.
Source§

impl From<Box<dyn Error + Send + Sync>> for CanoError

Source§

fn from(err: Box<dyn Error + Send + Sync>) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for CanoError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<StoreError> for CanoError

Source§

fn from(err: StoreError) -> Self

Converts to this type from the input type.
Source§

impl From<String> for CanoError

Source§

fn from(err: String) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for CanoError

Source§

fn eq(&self, other: &CanoError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for CanoError

Source§

impl StructuralPartialEq for CanoError

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V