use std::fmt::{Display, Formatter};
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum StructuralModelError {
Empty {
kind: &'static str,
},
InvalidFormat {
kind: &'static str,
value: String,
message: &'static str,
},
}
impl Display for StructuralModelError {
fn fmt(&self, formatter: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Self::Empty { kind } => write!(formatter, "{kind} must not be empty"),
Self::InvalidFormat {
kind,
value,
message,
} => write!(formatter, "invalid {kind}: {message} (got: {value})"),
}
}
}
impl std::error::Error for StructuralModelError {}