use std::io;
use thiserror::Error;
pub(crate) type Result<T> = std::result::Result<T, Errors>;
#[derive(Debug, Error)]
pub enum Errors {
#[error("Invalid file type")]
InvalidFileType,
#[error("Invalid key area length")]
InvalidKeyLength,
#[error("Invalid info area length")]
InvalidInfoLength,
#[error("Invalid image area length")]
InvalidImageLength,
#[error("Can't decode information")]
InfoDecodeError,
#[error("Can't decrypt")]
DecryptError,
#[error("Unknown error")]
Unknown,
#[error("Decode error")]
Decode,
#[error("IO Error: {0}")]
IO(String),
}
impl From<io::Error> for Errors {
fn from(value: io::Error) -> Self {
Self::IO(value.to_string())
}
}