diff options
author | Ferris Tseng <ferristseng@fastmail.fm> | 2017-10-09 16:39:10 -0400 |
---|---|---|
committer | Ferris Tseng <ferristseng@fastmail.fm> | 2017-10-09 16:39:10 -0400 |
commit | 68e3845290e8e6758a3f0f454b34ec28f29f62ed (patch) | |
tree | 14e6dd72eae0e9aa5a79aab1506c30cf2364dea2 /ipfs-api/src/response/error.rs | |
parent | 75854c6ad64227a049807b13447bd0ea09f2320f (diff) |
use reqwest instead of hyper
Diffstat (limited to 'ipfs-api/src/response/error.rs')
-rw-r--r-- | ipfs-api/src/response/error.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ipfs-api/src/response/error.rs b/ipfs-api/src/response/error.rs index 3eb8f1b..e56c249 100644 --- a/ipfs-api/src/response/error.rs +++ b/ipfs-api/src/response/error.rs @@ -1,18 +1,25 @@ -use hyper; +use reqwest; use serde_json; use std::fmt::{self, Display, Formatter}; #[derive(Debug)] pub enum Error { - Http(hyper::error::Error), + Http(reqwest::Error), Parse(serde_json::Error), + Url(reqwest::UrlError), Api(ApiError), Uncategorized(String), } -impl From<hyper::error::Error> for Error { - fn from(error: hyper::error::Error) -> Self { +impl From<reqwest::UrlError> for Error { + fn from(error: reqwest::UrlError) -> Self { + Error::Url(error) + } +} + +impl From<reqwest::Error> for Error { + fn from(error: reqwest::Error) -> Self { Error::Http(error) } } @@ -40,6 +47,7 @@ impl ::std::error::Error for Error { match *self { Error::Http(_) => "an http error occured", Error::Parse(_) => "an error occursed while parsing the api response", + Error::Url(_) => "an error occured while parsing the request url", Error::Api(_) => "an api error occured", Error::Uncategorized(_) => "an unknown error occured", } |