garbage/src/errors.rs
2019-06-26 02:46:46 -05:00

32 lines
640 B
Rust

#[derive(Debug)]
pub enum Error {
Io(std::io::Error),
WalkDir(walkdir::Error),
BadTrashInfo(TrashInfoError),
ParseDate(chrono::format::ParseError),
}
#[derive(Debug)]
pub enum TrashInfoError {
MissingHeader,
MissingPath,
MissingDate,
}
impl From<std::io::Error> for Error {
fn from(err: std::io::Error) -> Self {
Error::Io(err)
}
}
impl From<walkdir::Error> for Error {
fn from(err: walkdir::Error) -> Self {
Error::WalkDir(err)
}
}
impl From<chrono::format::ParseError> for Error {
fn from(err: chrono::format::ParseError) -> Self {
Error::ParseDate(err)
}
}