use std::{
fmt::{Display, Formatter, Result},
io::Error,
};
#[derive(Debug)]
pub enum AttachmentError {
Unreadable(String, Error),
}
impl std::error::Error for AttachmentError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
AttachmentError::Unreadable(_, e) => Some(e),
}
}
}
impl Display for AttachmentError {
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
match self {
AttachmentError::Unreadable(path, why) => {
write!(fmt, "Unable to read file at {path}: {why}")
}
}
}
}