use std::{error::Error, fmt};
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum FileError {
Unsupported(String),
Io(String),
Platform(String),
}
impl FileError {
pub(crate) fn io(error: &std::io::Error) -> Self {
Self::Io(error.to_string())
}
}
impl fmt::Display for FileError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Unsupported(reason) | Self::Io(reason) | Self::Platform(reason) => {
f.write_str(reason)
}
}
}
}
impl Error for FileError {}