summaryrefslogtreecommitdiff
path: root/src/error.rs
blob: 6afa3d0a262c622391d2a8f16a54d7df9c5cb899 (plain) (blame)
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
26
27
28
29
30
31
32
33
34
35
36
37
pub type Result<T> = std::result::Result<T, Error>;

#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error("unknown custom directory '{0}'")]
    CustomDirectory(String),

    #[error("invalid directory index '{0}'")]
    InvalidIndex(String),

    #[error("no directory index given")]
    NoIndex,

    #[error("invalid directory '{0}'")]
    InvalidDirectory(String),

    #[error("Only exactly one user allowed in config")]
    MultiUser,

    #[error("OsString couldn't be converted to string")]
    InvalidOsString,

    #[error("Requested backup not found")]
    BackupNotFound,

    #[error("json: {source}")]
    SerdeJson {
        #[from]
        source: serde_json::Error,
    },

    #[error("io: {source}")]
    Io {
        #[from]
        source: std::io::Error,
    }
}