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
use flex_error::{define_error, TraceError};

define_error! {
    Error {
        Io
            [ TraceError<std::io::Error> ]
            |_| { "config I/O error" },

        Decode
            [ TraceError<toml::de::Error> ]
            |_| { "invalid configuration" },

        InvalidCompatMode
            { compat_mode: String, valide_modes: &'static str }
            |e| { format!("invalid compatibility mode: '{}' (supported: {})", e.compat_mode, e.valide_modes) },

        Encode
            [ TraceError<toml::ser::Error> ]
            |_| { "invalid configuration" },

        InvalidGasPrice
            { price: String }
            |e| { format!("invalid gas price: {}", e.price) },
    }
}