use std::{
error,
fmt::{self, Display, Formatter},
};
#[derive(Debug)]
pub enum SteganographyError {
InvalidIVData(String),
InsufficientPlaneNumber(usize, usize),
}
impl Display for SteganographyError {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), fmt::Error> {
match self {
Self::InsufficientPlaneNumber(expected, got) => {
write!(
f,
"Tried to do an operation that requires at least {expected} planes, got {got}"
)
}
Self::InvalidIVData(reason) => {
write!(f, "The extracted IV data is invalid: {reason}")
}
}
}
}
impl error::Error for SteganographyError {}