bpf_api/
error.rs

1use thiserror::Error;
2
3use std::io::Error as IoError;
4use std::num::{ParseIntError, TryFromIntError};
5
6#[derive(Debug, Error)]
7pub enum Error {
8    #[error("a system error occurred")]
9    SystemError(isize),
10
11    #[error("an IO error occurred")]
12    IoError(#[from] IoError),
13
14    #[error("an error occurred when parsing an integer")]
15    ParseIntError(#[from] ParseIntError),
16
17    #[error("an error occurred when converting an integer")]
18    TryFromIntError(#[from] TryFromIntError),
19
20    #[error("unrecoverable error due to mutex poisoning")]
21    MutexPoisoned,
22
23    #[error("this isn't implemented")]
24    NotImplemented,
25
26    #[error("an invalid argument was given")]
27    InvalidArgument,
28
29    #[error("value was out of range")]
30    OutOfRange,
31}
32
33pub type Result<T> = std::result::Result<T, Error>;