1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use std::io::Error as IOError;
use hyper::error::{Error as HyperError, ParseError};
#[derive(Debug)]
pub enum HttpRequestError {
UrlParseError(ParseError),
HyperError(HyperError),
IOError(IOError),
RedirectError(&'static str),
TooLarge,
TimeOut,
LocalNotAllow,
Other(&'static str),
}
impl From<ParseError> for HttpRequestError {
#[inline]
fn from(error: ParseError) -> Self {
HttpRequestError::UrlParseError(error)
}
}
impl From<HyperError> for HttpRequestError {
#[inline]
fn from(error: HyperError) -> Self {
HttpRequestError::HyperError(error)
}
}
impl From<IOError> for HttpRequestError {
#[inline]
fn from(error: IOError) -> Self {
HttpRequestError::IOError(error)
}
}