use core::{
error,
fmt::{self, Debug, Display, Formatter},
};
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Error {
ArgumentCount,
ConsExpected,
BytecodeEnd,
IllegalInstruction,
IllegalPrimitive,
NumberExpected,
OutOfMemory,
ProcedureExpected,
}
impl error::Error for Error {}
impl Display for Error {
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
match self {
Self::ArgumentCount => write!(formatter, "invalid argument count"),
Self::BytecodeEnd => write!(formatter, "unexpected end of bytecodes"),
Self::ConsExpected => write!(formatter, "cons expected"),
Self::IllegalInstruction => write!(formatter, "illegal instruction"),
Self::IllegalPrimitive => write!(formatter, "illegal primitive"),
Self::NumberExpected => write!(formatter, "number expected"),
Self::OutOfMemory => write!(formatter, "out of memory"),
Self::ProcedureExpected => write!(formatter, "procedure expected"),
}
}
}