use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("unexpected end of data at offset {offset} (needed {needed} more byte(s))")]
UnexpectedEof {
offset: usize,
needed: usize,
},
#[error("invalid data: {0}")]
InvalidData(&'static str),
#[error("file `{0}` not found in archive")]
FileNotFound(String),
#[error("failed to decode `{0}` as BLP or TGA")]
UnsupportedImage(String),
#[error(transparent)]
Image(#[from] image::ImageError),
#[error(transparent)]
BlpParse(#[from] image_blp::parser::LoadError),
#[error(transparent)]
BlpConvert(#[from] image_blp::convert::Error),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error("feature `{0}` is required for this operation")]
FeatureRequired(&'static str),
#[cfg(feature = "serde")]
#[error(transparent)]
Json(#[from] serde_json::Error),
}
pub type Result<T, E = Error> = std::result::Result<T, E>;