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
use thiserror::Error;

#[derive(Error, Debug)]
pub enum Error {
    #[error(transparent)]
    Ignore(#[from] ignore::Error),
    #[error(transparent)]
    GlobPattern(#[from] glob::PatternError),
    #[error(transparent)]
    Glob(#[from] glob::GlobError),
    #[error(transparent)]
    ShellExpandLookup(#[from] shellexpand::LookupError<Box<Error>>),
    #[error(transparent)]
    Io(#[from] std::io::Error),
    #[error(transparent)]
    SerializeToml(#[from] toml::ser::Error),
    #[error(transparent)]
    DeserializeToml(#[from] toml::de::Error),
}

impl From<shellexpand::LookupError<Error>> for Error {
    fn from(error: shellexpand::LookupError<Error>) -> Self {
        Self::ShellExpandLookup(shellexpand::LookupError {
            var_name: error.var_name,
            cause: Box::new(error.cause),
        })
    }
}