#[derive(Debug)]
#[cfg_attr(feature = "thiserror", derive(thiserror::Error))]
pub enum Error {
#[cfg(feature = "std")]
#[cfg_attr(feature = "thiserror", error("Input/output error"))]
Io(std::io::Error),
#[cfg_attr(feature = "thiserror", error("Unrecognized format"))]
UnrecognizedFormat,
#[cfg_attr(
feature = "thiserror",
error("Cryptographic error: bad integrity/password")
)]
Cryptography,
#[cfg_attr(
feature = "thiserror",
error("Container size exceeds architectural limit")
)]
TooLarge,
#[cfg_attr(
feature = "thiserror",
error("Insufficient buffer size for decrypted data")
)]
TooShort,
}
#[cfg(feature = "std")]
impl From<std::io::Error> for Error {
fn from(err: std::io::Error) -> Self {
match err.kind() {
std::io::ErrorKind::UnexpectedEof => Error::TooShort,
_ => Error::Io(err),
}
}
}