use thiserror::Error;
#[derive(Debug, Clone, PartialEq, Eq, Error)]
#[non_exhaustive]
pub enum TabularError {
#[error("{entity}: row {row} has {found} cells, the first row has {expected}")]
RaggedRow {
entity: &'static str,
row: usize,
expected: usize,
found: usize,
},
#[error("{entity}: {found} heading rows, at most one is allowed")]
TooManyHeadings {
entity: &'static str,
found: usize,
},
#[error("{entity}.{attribute} requires at least one entry")]
EmptyList {
entity: &'static str,
attribute: &'static str,
},
#[error("{entity}.{attribute} requires a non-blank value")]
BlankRequired {
entity: &'static str,
attribute: &'static str,
},
#[error("{entity}.{attribute} requires a finite value")]
NotFinite {
entity: &'static str,
attribute: &'static str,
},
}
pub type TabularResult<T> = Result<T, TabularError>;