use thiserror::Error;
#[derive(Debug, Error)]
pub enum DecError {
#[error("empty mesh")]
EmptyMesh,
#[error("index out of bounds: index {index} in collection of size {len}")]
IndexOutOfBounds { index: usize, len: usize },
#[error("mesh is not well-centered: simplex {simplex} has negative dual volume {volume:.6e}")]
NotWellCentered { simplex: usize, volume: f64 },
#[error("Laplacian is singular; add a Dirichlet pin or use pseudoinverse")]
SingularLaplacian,
#[error("field length mismatch: expected {expected}, got {got}")]
FieldLengthMismatch { expected: usize, got: usize },
#[error("linear algebra error: {0}")]
LinearAlgebra(String),
}