summaryrefslogtreecommitdiffhomepage
path: root/tools/unitctl/unit-openapi/src/apis/error.rs
blob: a4a1e35412e8b4f118c45c9a1466786e4c2b662a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::apis::Error;
use std::error::Error as StdError;
use std::fmt::{Display, Formatter};

impl Display for Error {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        match self {
            Error::Api(e) => write!(f, "ApiError: {:#?}", e),
            Error::Header(e) => write!(f, "HeaderError: {}", e),
            Error::Http(e) => write!(f, "HttpError: {:#?}", e),
            Error::Hyper(e) => write!(f, "HyperError: {:#?}", e),
            Error::Serde(e) => write!(f, "SerdeError: {:#?}", e),
            Error::UriError(e) => write!(f, "UriError: {:#?}", e),
        }
    }
}

impl StdError for Error {}