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
// Copyright (c) 2015 - 2016, Alberto Corona <ac@albertocorona.com>
// All rights reserved. This file is part of yabs, distributed under the BSD
// 3-Clause license. For full terms please see the LICENSE file.

extern crate error_chain;
extern crate toml;
extern crate walkdir;
extern crate ansi_term;
extern crate serde_json;
extern crate log;
extern crate regex;

error_chain! {
    types {
        YabsError, YabsErrorKind, Result;
    }

    foreign_links {
        Io(::std::io::Error);
        TomlDe(::toml::de::Error);
        WalkDir(::walkdir::Error);
        SetLog(::log::SetLoggerError);
        UTF8(::std::string::FromUtf8Error);
        Regex(::regex::Error);
    }

    errors {
        NoAssumedToml(path: String) {
            description("no assumed toml file found")
                display("could not find assumed toml file in '{}' or in any parent directory", path)
        }
        Command(cmd: String, status: i32) {
            description("command exited unsuccessfully")
                display("command '{}' exited with status '{}'", cmd, status)
        }
        DirExists(path: ::std::path::PathBuf) {
            description("directory already exists")
                display("directory '{}' already exists", path.display())
        }
        TargetNotFound(ttype: String, name: String) {
            description("target not found")
                display("no {} with name '{}' found", ttype, name)
        }
    }
}