pub enum GraphError {
EmptyGraph,
NodeNotFound(usize),
CycleDetected,
SubgraphCycle,
SubgraphNotFound(usize),
ArenaOom,
BuilderFailed,
ExceedsMaxNodes {
count: usize,
max: usize,
},
ExceedsMaxLevels {
depth: usize,
max: usize,
},
}Expand description
Unified error type for all graph and layout operations.
Each variant carries a WDP error code accessible via GraphError::code(),
and an actionable hint via GraphError::hint().
§WDP Code Mapping
| Variant | WDP Code | Meaning |
|---|---|---|
EmptyGraph | E.Graph.Node.001 | MISSING — no nodes |
NodeNotFound | E.Graph.Node.021 | NOT_FOUND — node absent |
CycleDetected | E.Graph.Dag.003 | INVALID — DAG constraint violated |
SubgraphCycle | E.Graph.Subgraph.003 | INVALID — nesting cycle |
SubgraphNotFound | E.Graph.Subgraph.021 | NOT_FOUND — subgraph absent |
ArenaOom | E.ArenaLayout.Alloc.026 | EXHAUSTED — arena memory |
BuilderFailed | E.ArenaLayout.Builder.026 | EXHAUSTED — builder alloc |
ExceedsMaxNodes | E.ArenaLayout.Node.004 | OVERFLOW — index type full |
ExceedsMaxLevels | E.ArenaLayout.Level.004 | OVERFLOW — too deep |
§Examples
use ascii_dag::GraphError;
let err = GraphError::EmptyGraph;
assert_eq!(err.code(), "E.Graph.Node.001");
assert!(!err.hint().is_empty());Variants§
EmptyGraph
The graph has no nodes.
WDP: E.Graph.Node.001 (MISSING)
NodeNotFound(usize)
A referenced node ID does not exist in the graph.
WDP: E.Graph.Node.021 (NOT_FOUND)
CycleDetected
The graph contains a cycle but acyclicity was required.
WDP: E.Graph.Dag.003 (INVALID)
SubgraphCycle
Subgraph nesting would create a cycle in the hierarchy.
WDP: E.Graph.Subgraph.003 (INVALID)
SubgraphNotFound(usize)
A referenced subgraph ID does not exist.
WDP: E.Graph.Subgraph.021 (NOT_FOUND)
ArenaOom
The arena allocator ran out of memory.
WDP: E.ArenaLayout.Alloc.026 (EXHAUSTED)
Use Graph::estimate_layout_arena_size() to compute the required size.
BuilderFailed
The IR builder failed to allocate output structures.
WDP: E.ArenaLayout.Builder.026 (EXHAUSTED)
ExceedsMaxNodes
The graph has more nodes or edges than the selected index type supports.
WDP: E.ArenaLayout.Node.004 (OVERFLOW)
Fields
ExceedsMaxLevels
The graph’s longest path exceeds the maximum level depth.
WDP: E.ArenaLayout.Level.004 (OVERFLOW)
Implementations§
Source§impl GraphError
impl GraphError
Trait Implementations§
Source§impl Clone for GraphError
impl Clone for GraphError
Source§fn clone(&self) -> GraphError
fn clone(&self) -> GraphError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphError
impl Debug for GraphError
Source§impl Display for GraphError
impl Display for GraphError
Source§impl Error for GraphError
Available on crate feature std only.
impl Error for GraphError
std only.1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<GraphError> for Diagnostic
Available on crate feature alloc only.
impl From<GraphError> for Diagnostic
alloc only.