use std::fmt::{Display, Formatter};
use std::error::Error;
use std::result::Result;
use std::fmt;
#[derive(Debug)]
pub enum HypixelError {
Reqwest(reqwest::Error),
FailedResponse(u16, String),
Json(serde_json ::Error)
}
impl Error for HypixelError {}
impl Display for HypixelError {
fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> {
use HypixelError::*;
match self {
Reqwest(e) => write!(f, "Reqwest error: {}", e)?,
FailedResponse(c, r) => write!(f, "Unexpected status code: {} reason: {}", c, r)?,
Json(e) => write!(f, "Could not de-serialize JSON: {}", e)?,
}
Ok(())
}
}