summaryrefslogtreecommitdiffstats
path: root/ipfs-api/src/response/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ipfs-api/src/response/error.rs')
-rw-r--r--ipfs-api/src/response/error.rs66
1 files changed, 33 insertions, 33 deletions
diff --git a/ipfs-api/src/response/error.rs b/ipfs-api/src/response/error.rs
index c98d183..996a313 100644
--- a/ipfs-api/src/response/error.rs
+++ b/ipfs-api/src/response/error.rs
@@ -9,8 +9,8 @@
use crate::serde::Deserialize;
use std::string::FromUtf8Error;
-#[cfg_attr(feature = "actix", derive(Display), display(fmt = "{}", message))]
-#[cfg_attr(feature = "hyper", derive(Fail), fail(display = "{}", message))]
+#[cfg_attr(feature = "with-actix", derive(Display), display(fmt = "{}", message))]
+#[cfg_attr(feature = "with-hyper", derive(Fail), fail(display = "{}", message))]
#[derive(Debug, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct ApiError {
@@ -18,106 +18,106 @@ pub struct ApiError {
pub code: u8,
}
-#[cfg_attr(feature = "actix", derive(Display))]
-#[cfg_attr(feature = "hyper", derive(Fail))]
+#[cfg_attr(feature = "with-actix", derive(Display))]
+#[cfg_attr(feature = "with-hyper", derive(Fail))]
#[derive(Debug)]
pub enum Error {
/// Foreign errors.
- #[cfg(feature = "hyper")]
- #[cfg_attr(feature = "hyper", fail(display = "hyper client error '{}'", _0))]
+ #[cfg(feature = "with-hyper")]
+ #[cfg_attr(feature = "with-hyper", fail(display = "hyper client error '{}'", _0))]
Client(hyper::Error),
- #[cfg(feature = "actix")]
+ #[cfg(feature = "with-actix")]
#[cfg_attr(
- feature = "actix",
+ feature = "with-actix",
display(fmt = "actix client payload error '{}'", _0)
)]
ClientPayload(awc::error::PayloadError),
- #[cfg(feature = "actix")]
+ #[cfg(feature = "with-actix")]
#[cfg_attr(
- feature = "actix",
+ feature = "with-actix",
display(fmt = "actix client send request error '{}'", _0)
)]
ClientSend(awc::error::SendRequestError),
- #[cfg_attr(feature = "actix", display(fmt = "http error '{}'", _0))]
- #[cfg_attr(feature = "hyper", fail(display = "http error '{}'", _0))]
+ #[cfg_attr(feature = "with-actix", display(fmt = "http error '{}'", _0))]
+ #[cfg_attr(feature = "with-hyper", fail(display = "http error '{}'", _0))]
Http(http::Error),
- #[cfg_attr(feature = "actix", display(fmt = "json parse error '{}'", _0))]
- #[cfg_attr(feature = "hyper", fail(display = "json parse error '{}'", _0))]
+ #[cfg_attr(feature = "with-actix", display(fmt = "json parse error '{}'", _0))]
+ #[cfg_attr(feature = "with-hyper", fail(display = "json parse error '{}'", _0))]
Parse(serde_json::Error),
- #[cfg_attr(feature = "actix", display(fmt = "utf8 decoding error '{}'", _0))]
- #[cfg_attr(feature = "hyper", fail(display = "utf8 decoding error '{}'", _0))]
+ #[cfg_attr(feature = "with-actix", display(fmt = "utf8 decoding error '{}'", _0))]
+ #[cfg_attr(feature = "with-hyper", fail(display = "utf8 decoding error '{}'", _0))]
ParseUtf8(FromUtf8Error),
- #[cfg_attr(feature = "actix", display(fmt = "uri error '{}'", _0))]
- #[cfg_attr(feature = "hyper", fail(display = "uri error '{}'", _0))]
+ #[cfg_attr(feature = "with-actix", display(fmt = "uri error '{}'", _0))]
+ #[cfg_attr(feature = "with-hyper", fail(display = "uri error '{}'", _0))]
Url(http::uri::InvalidUri),
- #[cfg_attr(feature = "actix", display(fmt = "io error '{}'", _0))]
- #[cfg_attr(feature = "hyper", fail(display = "io error '{}'", _0))]
+ #[cfg_attr(feature = "with-actix", display(fmt = "io error '{}'", _0))]
+ #[cfg_attr(feature = "with-hyper", fail(display = "io error '{}'", _0))]
Io(std::io::Error),
- #[cfg_attr(feature = "actix", display(fmt = "url encoding error '{}'", _0))]
- #[cfg_attr(feature = "hyper", fail(display = "url encoding error '{}'", _0))]
+ #[cfg_attr(feature = "with-actix", display(fmt = "url encoding error '{}'", _0))]
+ #[cfg_attr(feature = "with-hyper", fail(display = "url encoding error '{}'", _0))]
EncodeUrl(serde_urlencoded::ser::Error),
/// An error returned by the Ipfs api.
- #[cfg_attr(feature = "actix", display(fmt = "api returned error '{}'", _0))]
- #[cfg_attr(feature = "hyper", fail(display = "api returned error '{}'", _0))]
+ #[cfg_attr(feature = "with-actix", display(fmt = "api returned error '{}'", _0))]
+ #[cfg_attr(feature = "with-hyper", fail(display = "api returned error '{}'", _0))]
Api(ApiError),
/// A stream error indicated in the Trailer header.
#[cfg_attr(
- feature = "actix",
+ feature = "with-actix",
display(fmt = "api returned an error while streaming: '{}'", _0)
)]
#[cfg_attr(
- feature = "hyper",
+ feature = "with-hyper",
fail(display = "api returned an error while streaming: '{}'", _0)
)]
StreamError(String),
/// API returned a trailer header with unrecognized value.
#[cfg_attr(
- feature = "actix",
+ feature = "with-actix",
display(fmt = "api returned a trailer header with unknown value: '{}'", _0)
)]
#[cfg_attr(
- feature = "hyper",
+ feature = "with-hyper",
fail(display = "api returned a trailer header with unknown value: '{}'", _0)
)]
UnrecognizedTrailerHeader(String),
#[cfg_attr(
- feature = "actix",
+ feature = "with-actix",
display(fmt = "api returned unknwon error '{}'", _0)
)]
#[cfg_attr(
- feature = "hyper",
+ feature = "with-hyper",
fail(display = "api returned unknwon error '{}'", _0)
)]
Uncategorized(String),
}
-#[cfg(feature = "hyper")]
+#[cfg(feature = "with-hyper")]
impl From<hyper::Error> for Error {
fn from(err: hyper::Error) -> Error {
Error::Client(err)
}
}
-#[cfg(feature = "actix")]
+#[cfg(feature = "with-actix")]
impl From<awc::error::SendRequestError> for Error {
fn from(err: awc::error::SendRequestError) -> Error {
Error::ClientSend(err)
}
}
-#[cfg(feature = "actix")]
+#[cfg(feature = "with-actix")]
impl From<awc::error::PayloadError> for Error {
fn from(err: awc::error::PayloadError) -> Error {
Error::ClientPayload(err)