summaryrefslogblamecommitdiff
path: root/src/error.rs
blob: e24c3b123e09275b62e5a58eb0441f39ac54b605 (plain) (tree)
1
2
3

                                                   
                                  












                                              


                                          



                                             


                                     





                                  





                                         



                               
      
 
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,

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

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

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

    #[error("toml serializer: {source}")]
    TomlSerialize {
        #[from]
        source: toml::ser::Error,
    },

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