crypto_rest_client/
error.rs

1use std::{error::Error as StdError, fmt};
2
3pub(crate) type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Debug)]
6pub struct Error(pub String);
7
8impl fmt::Display for Error {
9    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10        write!(f, "{}", self.0)
11    }
12}
13
14impl StdError for Error {}
15
16impl From<reqwest::Error> for Error {
17    fn from(err: reqwest::Error) -> Self {
18        Error(err.to_string())
19    }
20}
21
22impl From<serde_json::Error> for Error {
23    fn from(err: serde_json::Error) -> Self {
24        Error(err.to_string())
25    }
26}