use std::fmt;
#[derive(Debug)]
pub enum ExtractError {
NotFound(String),
NotExtractable { name: String, reason: String },
Internal(String),
}
impl fmt::Display for ExtractError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
ExtractError::NotFound(name) => write!(f, "Not found: {}", name),
ExtractError::NotExtractable { name, reason } => {
write!(f, "Cannot extract '{}': {}", name, reason)
}
ExtractError::Internal(msg) => write!(f, "Internal error: {}", msg),
}
}
}
impl std::error::Error for ExtractError {}