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
use super::Command;

error_chain! {
    foreign_links {
        Io(::std::io::Error);
        Utf8(std::str::Utf8Error);
        Regex(regex::Error);
        Json(serde_json::Error);
        GlobPattern(glob::PatternError);
        Log(log::SetLoggerError);
    }

    errors {
        PathExists(p: std::path::PathBuf) {
            display("path exists: '{}'",p.display())
        }
        PathDoesNotExist(p: std::path::PathBuf) {
            display("path does not exist: '{}'",p.display())
        }
        UnrecognizedCommand(command: String) {
            description("an unrecognized command"),
            display("unrecognized command '{}'",command)
        }
        ShebangNotFound(p: std::path::PathBuf) {
            display("shebang not found for '{}'",p.display())
        }
        CommandFailed(c: Command) {
            description("a command execution failed"),
            display("{}",c.err_str())
        }
    }
}