use crate::expr::{Expr, VarId};
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SolveError {
TooManyVariables {
found: usize,
max: usize,
},
UnknownVariable(VarId),
UnrecognizedForm(Expr),
}
impl std::fmt::Display for SolveError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
SolveError::TooManyVariables { found, max } => {
write!(f, "too many variables: {found} (max {max})")
}
SolveError::UnknownVariable(v) => write!(f, "unknown variable v{v}"),
SolveError::UnrecognizedForm(e) => {
write!(f, "solved linear MBA is in an unrecognized form: {e}")
}
}
}
}
impl std::error::Error for SolveError {}