bpf_ins/
error.rs

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