summaryrefslogtreecommitdiff
path: root/src/error.rs
blob: 73d4a66788aebb7f4b85792e78f3aa264f43601c (plain)
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
38
39
40
41
42
43
44
45
46
use crate::backup_run::BackupError;
use crate::client::{ClientConfigError, ClientError};
use crate::cmd::restore::RestoreError;
use crate::generation::{LocalGenerationError, NascentError};
use crate::genlist::GenerationListError;
use std::time::SystemTimeError;
use tempfile::PersistError;
use thiserror::Error;

/// Define all the kinds of errors that functions corresponding to
/// subcommands of the main program can return.
#[derive(Debug, Error)]
pub enum ObnamError {
    #[error(transparent)]
    GenerationListError(#[from] GenerationListError),

    #[error(transparent)]
    ClientError(#[from] ClientError),

    #[error(transparent)]
    ClientConfigError(#[from] ClientConfigError),

    #[error(transparent)]
    BackupError(#[from] BackupError),

    #[error(transparent)]
    NascentError(#[from] NascentError),

    #[error(transparent)]
    LocalGenerationError(#[from] LocalGenerationError),

    #[error(transparent)]
    RestoreError(#[from] RestoreError),

    #[error(transparent)]
    PersistError(#[from] PersistError),

    #[error(transparent)]
    IoError(#[from] std::io::Error),

    #[error(transparent)]
    SystemTimeError(#[from] SystemTimeError),

    #[error(transparent)]
    SerdeJsonError(#[from] serde_json::Error),
}