ruvector_delta_graph/
error.rs1use std::fmt;
4
5pub type Result<T> = std::result::Result<T, GraphDeltaError>;
7
8#[derive(Debug, Clone)]
10pub enum GraphDeltaError {
11 NodeNotFound(String),
13 EdgeNotFound(String),
15 InvalidOperation(String),
17 DeltaError(String),
19 CycleDetected,
21 ConstraintViolation(String),
23}
24
25impl fmt::Display for GraphDeltaError {
26 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
27 match self {
28 Self::NodeNotFound(id) => write!(f, "Node not found: {}", id),
29 Self::EdgeNotFound(id) => write!(f, "Edge not found: {}", id),
30 Self::InvalidOperation(msg) => write!(f, "Invalid operation: {}", msg),
31 Self::DeltaError(msg) => write!(f, "Delta error: {}", msg),
32 Self::CycleDetected => write!(f, "Cycle detected in graph"),
33 Self::ConstraintViolation(msg) => write!(f, "Constraint violation: {}", msg),
34 }
35 }
36}
37
38impl std::error::Error for GraphDeltaError {}