cortex_ai/
error.rs

1use std::{error::Error, fmt};
2
3/// Error type specific to Flow operations.
4#[derive(Debug, Clone)]
5pub enum FlowError {
6    Source(String),
7    Process(String),
8    Condition(String),
9    NoSource,
10    Custom(String),
11}
12
13impl fmt::Display for FlowError {
14    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15        match self {
16            Self::Source(msg) => write!(f, "Source error: {msg}"),
17            Self::Process(msg) => write!(f, "Process error: {msg}"),
18            Self::Condition(msg) => write!(f, "Condition error: {msg}"),
19            Self::NoSource => write!(f, "Flow error: No source configured"),
20            Self::Custom(msg) => write!(f, "Flow error: {msg}"),
21        }
22    }
23}
24impl Error for FlowError {}