use hyper::client::Response;
use std::{
error::Error as StdError,
fmt::{
Display,
Formatter,
Result as FmtResult
}
};
#[derive(Debug)]
pub enum Error {
UnsuccessfulRequest(Response),
RateLimitI64,
RateLimitUtf8,
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter) -> FmtResult { f.write_str(self.description()) }
}
impl StdError for Error {
fn description(&self) -> &str {
match *self {
Error::UnsuccessfulRequest(_) => {
"A non-successful response status code was received"
},
Error::RateLimitI64 => "Error decoding a header into an i64",
Error::RateLimitUtf8 => "Error decoding a header from UTF-8",
}
}
}