1use core::fmt;
7
8#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10#[non_exhaustive]
11pub enum LayeredFieldError {
12 InvalidInterval,
14 NonDisjointIntervals,
16 CellBudgetExceeded,
18 InvalidFrame,
20 InvalidBounds,
22 InvalidCellSize,
24 NonFiniteGeometry,
26 InvalidDimensions,
28 SampleBudgetExceeded,
30 UnbalancedCrossings,
32 DegenerateOccupancy,
34 InvalidEnvelope,
36 NodeOutsideField,
38 DimensionMismatch,
40}
41
42impl fmt::Display for LayeredFieldError {
43 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
44 let text = match self {
45 Self::InvalidInterval => "interval endpoints must be finite with start < end",
46 Self::NonDisjointIntervals => "occupancy intervals must be strictly disjoint",
47 Self::CellBudgetExceeded => "cell count exceeds the caller budget",
48 Self::InvalidFrame => "frame axes must be finite, orthonormal, and right-handed",
49 Self::InvalidBounds => "local bounds must be finite and non-degenerate",
50 Self::InvalidCellSize => "cell size must be finite and strictly positive",
51 Self::NonFiniteGeometry => "input geometry contains a non-finite coordinate",
52 Self::InvalidDimensions => "field dimensions are empty or unrepresentable",
53 Self::SampleBudgetExceeded => "stored layers exceed the caller budget",
54 Self::UnbalancedCrossings => "crossings do not alternate enter/exit",
55 Self::DegenerateOccupancy => "derived occupancy span collapsed within tolerance",
56 Self::InvalidEnvelope => "envelope values must be finite and non-negative",
57 Self::NodeOutsideField => "cell or support level is outside the field",
58 Self::DimensionMismatch => "operands do not share identical dimensions",
59 };
60 f.write_str(text)
61 }
62}
63
64impl std::error::Error for LayeredFieldError {}