1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Error, Debug)]
6pub enum Error {
7 #[error("not an il2cpp metadata file (bad sanity value {0:#x})")]
8 BadSanity(u32),
9 #[error("metadata version {0} is not supported")]
10 UnsupportedVersion(u32),
11 #[error("metadata section {0} is out of bounds or misaligned")]
12 BadSection(&'static str),
13 #[error("index {1} is out of range for {0}")]
14 BadIndex(&'static str, i64),
15 #[error("binary: {0}")]
16 Binary(String),
17 #[error("could not find {0}")]
18 NotFound(String),
19 #[error(transparent)]
20 Hao(#[from] hao::error::HaoError),
21 #[error("io error: {0}")]
22 Io(#[from] std::io::Error),
23}