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:
Jörg Sommer 2018-08-25 16:08:10 +02:00
parent 8970e3d83d
commit 08c0d14221
2 changed files with 10 additions and 0 deletions

View File

@ -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"

View File

@ -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)