poa-bridge/src/error.rs

29 lines
630 B
Rust
Raw Normal View History

2017-06-25 04:21:13 -07:00
use std::{io, fmt};
2017-08-01 02:36:48 -07:00
use {web3, toml, docopt};
2017-06-25 04:21:13 -07:00
2017-08-02 03:45:15 -07:00
error_chain! {
types {
Error, ErrorKind, ResultExt, Result;
2017-06-25 04:21:13 -07:00
}
2017-08-02 03:45:15 -07:00
foreign_links {
Io(io::Error);
Toml(toml::de::Error);
Docopt(docopt::Error);
2017-06-25 04:21:13 -07:00
}
2017-08-01 02:36:48 -07:00
2017-08-02 03:45:15 -07:00
errors {
2017-08-04 08:57:09 -07:00
// workaround for error_chain not allowing to check internal error kind
// https://github.com/rust-lang-nursery/error-chain/issues/206
MissingFile(filename: String) {
description("File not found"),
display("File {} not found", filename),
}
2017-08-02 03:45:15 -07:00
// workaround for lack of web3:Error Display and Error implementations
Web3(err: web3::Error) {
2017-08-04 08:57:09 -07:00
description("web3 error"),
display("{:?}", err),
2017-08-02 03:45:15 -07:00
}
2017-08-01 02:36:48 -07:00
}
}