No reason to impl Deser for both the ApiError and Error types

master
Paul Woolcock 6 years ago
parent 454d005517
commit 1847160369
  1. 13
      src/errors.rs

@ -13,39 +13,29 @@ use url::ParseError as UrlError;
pub type Result<T> = ::std::result::Result<T, Error>; pub type Result<T> = ::std::result::Result<T, Error>;
/// enum of possible errors encountered using the mastodon API. /// enum of possible errors encountered using the mastodon API.
#[derive(Debug, Deserialize)] #[derive(Debug)]
#[serde(untagged)]
pub enum Error { pub enum Error {
/// Error from the Mastodon API. This typically means something went /// Error from the Mastodon API. This typically means something went
/// wrong with your authentication or data. /// wrong with your authentication or data.
Api(ApiError), Api(ApiError),
/// Error deserialising to json. Typically represents a breaking change in /// Error deserialising to json. Typically represents a breaking change in
/// the Mastodon API /// the Mastodon API
#[serde(skip_deserializing)]
Serde(SerdeError), Serde(SerdeError),
/// Error encountered in the HTTP backend while requesting a route. /// Error encountered in the HTTP backend while requesting a route.
#[serde(skip_deserializing)]
Http(HttpError), Http(HttpError),
/// Wrapper around the `std::io::Error` struct. /// Wrapper around the `std::io::Error` struct.
#[serde(skip_deserializing)]
Io(IoError), Io(IoError),
/// Wrapper around the `url::ParseError` struct. /// Wrapper around the `url::ParseError` struct.
#[serde(skip_deserializing)]
Url(UrlError), Url(UrlError),
/// Missing Client Id. /// Missing Client Id.
#[serde(skip_deserializing)]
ClientIdRequired, ClientIdRequired,
/// Missing Client Secret. /// Missing Client Secret.
#[serde(skip_deserializing)]
ClientSecretRequired, ClientSecretRequired,
/// Missing Access Token. /// Missing Access Token.
#[serde(skip_deserializing)]
AccessTokenRequired, AccessTokenRequired,
/// Generic client error. /// Generic client error.
#[serde(skip_deserializing)]
Client(StatusCode), Client(StatusCode),
/// Generic server error. /// Generic server error.
#[serde(skip_deserializing)]
Server(StatusCode), Server(StatusCode),
} }
@ -104,4 +94,5 @@ from! {
IoError, Io, IoError, Io,
SerdeError, Serde, SerdeError, Serde,
UrlError, Url, UrlError, Url,
ApiError, Api,
} }

Loading…
Cancel
Save