rust_wheel 0.1.5

A project to define some public component.
Documentation
use std::fmt;
use crate::model::error::user::user_info_not_match::UserInfoNotMatchError;

#[derive(Debug)]
pub enum CustomError {
    HttpError = 0,
    ParseError = 1,
    UserInfoNotMatchError = 2,
}

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

impl fmt::Display for CustomError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match self {
            CustomError::HttpError => write!(f, "HTTP Error"),
            CustomError::ParseError => write!(f, "Parse Error"),
            CustomError::UserInfoNotMatchError => write!(f, "UserInfoNotMatch Error"),
        }
    }
}

impl From<UserInfoNotMatchError> for CustomError{
    fn from(_: UserInfoNotMatchError) -> Self {
        CustomError::UserInfoNotMatchError
    }
}

impl From<reqwest::Error> for CustomError {
    fn from(_: reqwest::Error) -> Self {
        CustomError::HttpError
    }
}

impl From<chrono::format::ParseError> for CustomError {
    fn from(_: chrono::format::ParseError) -> Self {
        CustomError::ParseError
    }
}