use core::fmt;
use std::error::Error;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum GeodeError {
EmptyTypeVector,
IndexOutOfBounds,
ArithmeticOverflow,
DivisionNotExact,
InvalidInput,
}
impl fmt::Display for GeodeError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::EmptyTypeVector => {
formatter.write_str("type vectors must contain at least one component")
},
Self::IndexOutOfBounds => formatter.write_str("type vector index is out of bounds"),
Self::ArithmeticOverflow => {
formatter.write_str("geode arithmetic overflowed its exact integer representation")
},
Self::DivisionNotExact => formatter.write_str("geode division was not exact"),
Self::InvalidInput => formatter.write_str("geode input violated a crate invariant"),
}
}
}
impl Error for GeodeError {}