1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum Error {
5 #[error("unknown opcode {0:#02x}")]
7 InvalidOpcode(u8),
8
9 #[error("unknown arithmetic operation {0:#02x}")]
11 InvalidArithmeticOperation(u8),
12
13 #[error("unknown jump operation {0:#02x}")]
15 InvalidJumpOperation(u8),
16
17 #[error("unknown memory operation size {0:#02x}")]
19 InvalidMemoryOpSize(u8),
20
21 #[error("unknown memory operation mode {0:#02x}")]
23 InvalidMemoryOpMode(u8),
24
25 #[error("unknown register number {0:#02x}")]
27 InvalidRegisterNumber(u8),
28
29 #[error("not enough instructions to decode")]
31 NotEnoughInstructions,
32}
33
34pub type Result<T> = std::result::Result<T, Error>;