Skip to main content

lc_langgraph/
errors.rs

1// crates/lc-langgraph/src/errors.rs
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum GraphError {
7    #[error("Validation error: {0}")]
8    ValidationError(String),
9
10    #[error("Execution error: {0}")]
11    ExecutionError(String),
12
13    #[error("Routing error: {0}")]
14    RoutingError(String),
15
16    #[error("Recursion limit reached: {0}")]
17    RecursionLimitReached(usize),
18
19    #[error("Node error: {0}")]
20    NodeError(String),
21
22    #[error("Checkpoint error: {0}")]
23    CheckpointError(String),
24
25    #[error("State error: {0}")]
26    StateError(String),
27
28    #[error("Execution interrupted: {0}")]
29    ExecutionInterrupted(String),
30
31    #[error("Resume error: {0}")]
32    ResumeError(String),
33
34    #[error("Graph contains infinite cycle: {0}")]
35    InfiniteCycleError(String),
36
37    #[error("Orphan node detected: {0}")]
38    OrphanNodeError(String),
39
40    #[error("Duplicate edge: {0}")]
41    DuplicateEdgeError(String),
42
43    #[error("Missing route target: {0}")]
44    MissingRouteTargetError(String),
45
46    #[error("Runtime error: {0}")]
47    RuntimeError(String),
48}
49
50pub type GraphResult<T> = Result<T, GraphError>;