use std::{error::Error, fmt::Display, io};
#[derive(Debug, Clone)]
pub enum IWError {
Unknown(String),
NotSupport(String),
}
impl Display for IWError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
IWError::Unknown(msg) => write!(f, "Unknown err: {}", msg),
IWError::NotSupport(msg) => write!(f, "NotSupport: {}", msg),
}
}
}
impl Error for IWError {}
pub type Result<T = ()> = std::result::Result<T, IWError>;
impl From<io::Error> for IWError {
fn from(value: io::Error) -> Self {
Self::Unknown(value.to_string())
}
}