use std;
#[derive(Debug)]
pub enum Error {
IOError(std::io::Error),
NotImplemented,
InvalidFATFormat
}
pub type Result<T> = std::result::Result<T, Error>;
impl std::error::Error for Error {
fn description(&self) -> &str {
match *self {
Error::IOError(ref e) => e.description(),
Error::NotImplemented => "Not implemented yet",
Error::InvalidFATFormat => "Invalid FAT format"
}
}
fn cause(&self) -> Option<&std::error::Error> {
match *self {
Error::IOError(ref e) => Some(e),
_ => None,
}
}
}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
use std::error::Error;
write!(f, "{}", self.description())
}
}