1use core::{
2 error,
3 fmt::{self, Debug, Display, Formatter},
4};
5
6#[derive(Clone, Debug, Eq, PartialEq)]
8pub enum Error {
9 ArgumentCount,
11 ConsExpected,
13 BytecodeEnd,
15 IllegalInstruction,
17 IllegalPrimitive,
19 NumberExpected,
21 OutOfMemory,
23 ProcedureExpected,
25}
26
27impl error::Error for Error {}
28
29impl Display for Error {
30 fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
31 match self {
32 Self::ArgumentCount => write!(formatter, "invalid argument count"),
33 Self::BytecodeEnd => write!(formatter, "unexpected end of bytecodes"),
34 Self::ConsExpected => write!(formatter, "cons expected"),
35 Self::IllegalInstruction => write!(formatter, "illegal instruction"),
36 Self::IllegalPrimitive => write!(formatter, "illegal primitive"),
37 Self::NumberExpected => write!(formatter, "number expected"),
38 Self::OutOfMemory => write!(formatter, "out of memory"),
39 Self::ProcedureExpected => write!(formatter, "procedure expected"),
40 }
41 }
42}