Skip to main content

eosio_shipper_gf/
errors.rs

1use error_chain::error_chain;
2
3impl From<Box<dyn std::error::Error>> for Error {
4    fn from(e: Box<dyn std::error::Error>) -> Self {
5        Self::from(format!("{:?}", e))
6    }
7}
8
9impl From<Box<dyn std::error::Error + Sync + Send>> for Error {
10    fn from(e: Box<dyn std::error::Error + Sync + Send>) -> Self {
11        Self::from(format!("{:?}", e))
12    }
13}
14
15#[cfg(test)]
16impl PartialEq for Error {
17    fn eq(&self, _other: &Self) -> bool {
18        // This might be Ok since we try to compare Result in tests
19        false
20    }
21}
22
23error_chain! {
24    foreign_links {
25        UTF8(std::string::FromUtf8Error);
26        Tungtentie(tokio_tungstenite::tungstenite::error::Error);
27        SerdeJson(serde_json::error::Error);
28    }
29    errors {
30        ExpectedABI{
31            description("expected shipper ABI")
32            display("expected shipper ABI")
33        }
34    }
35}