use std::fmt;
#[derive(Debug)]
pub enum NeatifyError {
UnsupportedFile(String),
IoError(std::io::Error),
FormattingError(String),
}
impl fmt::Display for NeatifyError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
NeatifyError::UnsupportedFile(path) => write!(f, "Unsupported file: {}", path),
NeatifyError::IoError(err) => write!(f, "IO error: {}", err),
NeatifyError::FormattingError(msg) => write!(f, "Formatting error: {}", msg),
}
}
}
impl std::error::Error for NeatifyError {}
impl From<std::io::Error> for NeatifyError {
fn from(err: std::io::Error) -> Self {
NeatifyError::IoError(err)
}
}