btf_rs/error.rs
1//! Errors returned from `btf-rs`.
2
3use thiserror;
4
5pub type Result<T> = std::result::Result<T, Error>;
6
7/// Errors returned by the `btf-rs` crate.
8#[non_exhaustive]
9#[derive(thiserror::Error, Debug)]
10pub enum Error {
11 /// I/O error, from `std::io::Error`.
12 #[error("i/o error: {0}")]
13 IO(#[from] std::io::Error),
14 /// Format error: invalid input file or directory, wrongly formatted file,
15 /// invalid BTF format.
16 #[error("{0}")]
17 Format(String),
18 /// Operation not supported.
19 #[error("operation not supported: {0}")]
20 OpNotSupp(String),
21 /// Invalid type.
22 #[error("no type with id {0}")]
23 InvalidType(u32),
24 /// Invalid string reference.
25 #[error("no string at offset {0}")]
26 InvalidString(u32),
27}