summaryrefslogblamecommitdiff
path: root/src/error.rs
blob: 8270b453d4197199882e076b5d4032a05ff89bae (plain) (tree)
1
2
3
4
5

                   

                                                   
                                  












                                              


                                          



                                          



                                             


                                     

                         


                                        




                                            




                                              

                               


                                                   
 
use tracing::error;

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("Requested backup not found")]
    BackupNotFound,

    // Utils
    #[error("System directory not found")]
    NoSysDir,

    // Packages
    #[error("Unknown Package Manger Output")]
    UnknownOutput,

    #[error("Unsupported os/distro")]
    Unsupported,

    // Deps
    #[error(transparent)]
    Config(#[from] config::ConfigError),

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

    #[error(transparent)]
    TomlSerialize(#[from] toml::ser::Error),

    #[cfg(feature = "notifications")]
    #[error(transparent)]
    Notify(#[from] notify_rust::error::Error),

    // Rust
    #[error(transparent)]
    Io(#[from] std::io::Error),

    #[error(transparent)]
    SystemTime(#[from] std::time::SystemTimeError),
}