#[derive(Debug)]
pub enum Error {
IOError(std::io::Error),
FormatError(String),
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Error::IOError(e) => f.write_fmt(format_args!("IOError: {e}")),
Error::FormatError(e) => f.write_fmt(format_args!("NIB Archive format error: {e}")),
}
}
}
impl std::error::Error for Error {}
impl From<std::io::Error> for Error {
fn from(value: std::io::Error) -> Self {
Self::IOError(value)
}
}
impl From<std::string::FromUtf8Error> for Error {
fn from(value: std::string::FromUtf8Error) -> Self {
Self::FormatError(value.to_string())
}
}