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]
|
[dependencies]
|
||||||
futures = "0.1.15"
|
futures = "0.1.15"
|
||||||
http = "0.1.0"
|
http = "0.1.0"
|
||||||
|
hyper = "0.12"
|
||||||
serde_json = "1.0.3"
|
serde_json = "1.0.3"
|
||||||
serde_urlencoded = "0.5.1"
|
serde_urlencoded = "0.5.1"
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
extern crate http;
|
extern crate http;
|
||||||
|
extern crate hyper;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern crate ruma_identifiers;
|
extern crate ruma_identifiers;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@ -45,6 +46,8 @@ pub trait Endpoint<T, U> {
|
|||||||
pub enum Error {
|
pub enum Error {
|
||||||
/// An HTTP error.
|
/// An HTTP error.
|
||||||
Http(http::Error),
|
Http(http::Error),
|
||||||
|
/// An Hyper error.
|
||||||
|
Hyper(hyper::Error),
|
||||||
/// A I/O error.
|
/// A I/O error.
|
||||||
Io(io::Error),
|
Io(io::Error),
|
||||||
/// A Serde JSON 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 {
|
impl From<io::Error> for Error {
|
||||||
fn from(error: io::Error) -> Self {
|
fn from(error: io::Error) -> Self {
|
||||||
Error::Io(error)
|
Error::Io(error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user