1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use core::fmt;

use http_api_client_endpoint::http::Error as HttpError;
use serde_json::Error as SerdeJsonError;
use url::ParseError as UrlParseError;

//
#[derive(Debug)]
pub enum EndpointError {
    MakeRequestUrlFailed(UrlParseError),
    MakeRequestFailed(HttpError),
    SerRequestBodyJsonFailed(SerdeJsonError),
    DeResponseBodyJsonFailed(SerdeJsonError),
}

impl fmt::Display for EndpointError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{:?}", self)
    }
}

impl std::error::Error for EndpointError {}