use std::fmt::{Display, Formatter};
#[derive(Debug)]
pub enum Error {
Null,
Unsupported,
Ascii,
Format(std::fmt::Error),
IO(std::io::Error),
UTF8(std::str::Utf8Error),
FromUtf8(std::string::FromUtf8Error),
CommandNotFound,
TestFailed,
FileNotFound,
}
impl From<std::fmt::Error> for Error {
fn from(e: std::fmt::Error) -> Self {
Self::Format(e)
}
}
impl From<std::io::Error> for Error {
fn from(e: std::io::Error) -> Self {
Self::IO(e)
}
}
impl From<std::str::Utf8Error> for Error {
fn from(e: std::str::Utf8Error) -> Self {
Self::UTF8(e)
}
}
impl From<std::string::FromUtf8Error> for Error {
fn from(e: std::string::FromUtf8Error) -> Self {
Self::FromUtf8(e)
}
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "Interoptopus failed!")
}
}
impl std::error::Error for Error {}