#[derive(Debug, Clone, PartialEq, thiserror::Error)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum GridError {
#[error("expected {expected} values, got {got}")]
ShapeMismatch {
expected: usize,
got: usize,
},
#[error("{axis} axis has too few samples ({len}); need ≥ 2")]
TooFewSamples {
axis: &'static str,
len: usize,
},
#[error("{axis} axis is not strictly monotonic at index {at_index}")]
NotMonotonic {
axis: &'static str,
at_index: usize,
},
#[error("{axis} axis contains non-finite value at index {index}")]
NonFinite {
axis: &'static str,
index: usize,
},
#[error("step must be positive (got {step})")]
NonPositiveStep {
step: f64,
},
#[error("{axis} axis is not uniformly spaced: expected step {expected}, got {got}")]
NonUniformStep {
axis: &'static str,
expected: f64,
got: f64,
},
#[error("{axis} value {value} is outside axis range [{lo}, {hi}]")]
OutOfRange {
axis: &'static str,
value: f64,
lo: f64,
hi: f64,
},
}