Skip to main content

graph_flow/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum GraphError {
5    #[error("Task execution failed: {0}")]
6    TaskExecutionFailed(String),
7
8    #[error("Graph not found: {0}")]
9    GraphNotFound(String),
10
11    #[error("Invalid edge: {0}")]
12    InvalidEdge(String),
13
14    #[error("Task not found: {0}")]
15    TaskNotFound(String),
16
17    #[error("Context error: {0}")]
18    ContextError(String),
19
20    #[error("Storage error: {0}")]
21    StorageError(String),
22
23    #[error("Session not found: {0}")]
24    SessionNotFound(String),
25
26    /// A save was rejected because the stored session changed since it was
27    /// loaded (optimistic-locking conflict). Reload the session and retry.
28    #[error("Session conflict: {0}")]
29    SessionConflict(String),
30
31    #[error(transparent)]
32    Other(#[from] anyhow::Error),
33}
34
35pub type Result<T> = std::result::Result<T, GraphError>;