http_type/response/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use http_constant::*;
use std::{
    error::Error as StdError,
    fmt::{self, Display},
};

#[derive(Debug)]
pub enum Error {
    ResponseError(String),
    Unknown,
}

impl StdError for Error {}

impl Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::ResponseError(data) => write!(f, "Response Error{}{}", COLON_SPACE, data),
            Self::Unknown => write!(f, "{}", "Unknown"),
        }
    }
}