garbage/src/errors.rs

26 lines
696 B
Rust
Raw Normal View History

2020-03-04 04:48:06 +00:00
/// All errors that could happen
2019-11-30 05:02:19 +00:00
#[derive(Debug, Error)]
2020-03-04 04:48:06 +00:00
#[allow(missing_docs)]
2019-06-26 07:46:46 +00:00
pub enum Error {
2019-11-30 05:02:19 +00:00
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Walkdir error: {0}")]
WalkDir(#[from] walkdir::Error),
#[error("Bad .trashinfo file: {0}")]
BadTrashInfo(#[from] TrashInfoError),
#[error("Date parsing error: {0}")]
ParseDate(#[from] chrono::format::ParseError),
2019-06-26 07:46:46 +00:00
}
2020-03-04 04:48:06 +00:00
/// Errors related to .trashinfo files
2019-11-30 05:02:19 +00:00
#[derive(Debug, Error)]
2020-03-04 04:48:06 +00:00
#[allow(missing_docs)]
2019-06-26 07:46:46 +00:00
pub enum TrashInfoError {
2019-11-30 05:02:19 +00:00
#[error("Missing [TrashInfo] header")]
2019-06-26 07:46:46 +00:00
MissingHeader,
2019-11-30 05:02:19 +00:00
#[error("Missing path attribute")]
2019-06-26 07:46:46 +00:00
MissingPath,
2019-11-30 05:02:19 +00:00
#[error("Missing date attribute")]
2019-06-26 07:46:46 +00:00
MissingDate,
}