use crate::Symbol;
#[derive(Debug)]
pub enum InitError {
Ambiguous { symbol: &'static Symbol },
Circular { symbols: Vec<&'static Symbol> },
}
impl std::fmt::Display for InitError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Ambiguous { symbol } => {
write!(f, "Symbol {symbol} is defined multiple times.")
}
Self::Circular { symbols } => {
writeln!(f, "Circular dependency detected among:")?;
for symbol in symbols {
writeln!(f, " {symbol}")?;
}
Ok(())
}
}
}
}
impl std::error::Error for InitError {}