rust_covfix/
error.rs

1use error_chain::error_chain;
2use std::fmt;
3use std::io;
4use std::path::PathBuf;
5
6error_chain! {
7    // The type defined for this error
8    types {
9        Error, ErrorKind, ResultExt;
10    }
11
12    // Automatic conversions between this error chain and other error types
13    foreign_links {
14        FmtError(fmt::Error);
15        IoError(io::Error);
16        ParseError(syn::Error);
17        RegexError(regex::Error);
18    }
19
20    // Custom errors
21    errors {
22        SourceFileNotFound(p: PathBuf) {
23            description("Source file not found"),
24            display("Source file {:?} not found", p)
25        }
26        InvalidRuleName(name: String) {
27            description("Invalid Rule name"),
28            display("Invalid Rule name: {:?}", name)
29        }
30    }
31}