util/
error.rs

1// Copyright (c) 2015 - 2016, Alberto Corona <ac@albertocorona.com>
2// All rights reserved. This file is part of yabs, distributed under the BSD
3// 3-Clause license. For full terms please see the LICENSE file.
4
5extern crate error_chain;
6extern crate toml;
7extern crate walkdir;
8extern crate ansi_term;
9extern crate serde_json;
10extern crate log;
11extern crate regex;
12
13error_chain! {
14    types {
15        YabsError, YabsErrorKind, Result;
16    }
17
18    foreign_links {
19        Io(::std::io::Error);
20        TomlDe(::toml::de::Error);
21        WalkDir(::walkdir::Error);
22        SetLog(::log::SetLoggerError);
23        UTF8(::std::string::FromUtf8Error);
24        Regex(::regex::Error);
25    }
26
27    errors {
28        NoAssumedToml(path: String) {
29            description("no assumed toml file found")
30                display("could not find assumed toml file in '{}' or in any parent directory", path)
31        }
32        Command(cmd: String, status: i32) {
33            description("command exited unsuccessfully")
34                display("command '{}' exited with status '{}'", cmd, status)
35        }
36        DirExists(path: ::std::path::PathBuf) {
37            description("directory already exists")
38                display("directory '{}' already exists", path.display())
39        }
40        TargetNotFound(ttype: String, name: String) {
41            description("target not found")
42                display("no {} with name '{}' found", ttype, name)
43        }
44    }
45}