~iptq/garbage

ref: 02ba29053be29149ec4ca4f73cd375f02f2cf21b garbage/src/errors.rs -rw-r--r-- 696 bytes
02ba2905Michael Zhang fix panic problem by not converting to utf-8 all the time 1 year, 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/// All errors that could happen
#[derive(Debug, Error)]
#[allow(missing_docs)]
pub enum Error {
    #[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),
}

/// Errors related to .trashinfo files
#[derive(Debug, Error)]
#[allow(missing_docs)]
pub enum TrashInfoError {
    #[error("Missing [TrashInfo] header")]
    MissingHeader,
    #[error("Missing path attribute")]
    MissingPath,
    #[error("Missing date attribute")]
    MissingDate,
}