use thiserror::Error;
pub type Result<T> = core::result::Result<T, ArchiveError>;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum ArchiveError {
#[error("{format} decode failed: {detail}")]
Decode {
format: &'static str,
detail: String,
},
#[error("decompressed output exceeds the {cap}-byte cap")]
TooLarge { cap: u64 },
#[error("{format} archive open failed: {detail}")]
Open {
format: &'static str,
detail: String,
},
#[error("{format} member read failed: {detail}")]
Read {
format: &'static str,
detail: String,
},
#[error("member index {index} out of range ({count} members)")]
IndexOutOfRange { index: usize, count: usize },
#[error("nesting depth exceeded the max of {max} at layer chain: {chain}")]
DepthExceeded { max: usize, chain: String },
#[error("member count exceeded the max of {max}")]
TooManyEntries { max: usize },
#[error("cumulative inflated size exceeded the {cap}-byte cap")]
TotalInflatedExceeded { cap: u64 },
}