Add Error(Hyper)
for errors originated from Hyper
During the parsing of the HTTP responses an error might come from *Hyper*. To pass this error down to the caller, we need an entry in `Error`.
This commit is contained in:
parent
8970e3d83d
commit
08c0d14221
@ -13,6 +13,7 @@ version = "0.5.0"
|
||||
[dependencies]
|
||||
futures = "0.1.15"
|
||||
http = "0.1.0"
|
||||
hyper = "0.12"
|
||||
serde_json = "1.0.3"
|
||||
serde_urlencoded = "0.5.1"
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
extern crate futures;
|
||||
extern crate http;
|
||||
extern crate hyper;
|
||||
#[cfg(test)]
|
||||
extern crate ruma_identifiers;
|
||||
#[cfg(test)]
|
||||
@ -45,6 +46,8 @@ pub trait Endpoint<T, U> {
|
||||
pub enum Error {
|
||||
/// An HTTP error.
|
||||
Http(http::Error),
|
||||
/// An Hyper error.
|
||||
Hyper(hyper::Error),
|
||||
/// A I/O error.
|
||||
Io(io::Error),
|
||||
/// A Serde JSON error.
|
||||
@ -65,6 +68,12 @@ impl From<http::Error> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<hyper::Error> for Error {
|
||||
fn from(error: hyper::Error) -> Self {
|
||||
Error::Hyper(error)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<io::Error> for Error {
|
||||
fn from(error: io::Error) -> Self {
|
||||
Error::Io(error)
|
||||
|
Loading…
x
Reference in New Issue
Block a user