1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, GraphError>;
7
8#[derive(Error, Debug)]
10pub enum GraphError {
11 #[error("Node not found: {0}")]
13 NodeNotFound(String),
14
15 #[error("Edge not found: from {from} to {to}")]
17 EdgeNotFound { from: String, to: String },
18
19 #[error("Cycle detected in graph involving node: {0}")]
21 CycleDetected(String),
22
23 #[error("Invalid graph structure: {0}")]
25 InvalidGraph(String),
26
27 #[error("Port validation error: {0}")]
29 PortError(String),
30
31 #[error("Execution error: {0}")]
33 ExecutionError(String),
34
35 #[error("Data type mismatch: expected {expected}, got {actual}")]
37 TypeMismatch { expected: String, actual: String },
38
39 #[error("Missing required input for node {node}: {port}")]
41 MissingInput { node: String, port: String },
42
43 #[error("{0}")]
45 Other(String),
46}