refactor(error): Better errors from the Mastodon API

master
Aaron Power 7 years ago
parent 845294996c
commit 87bcc139bb
  1. 4
      src/lib.rs

@ -275,7 +275,9 @@ impl fmt::Display for Error {
impl StdError for Error { impl StdError for Error {
fn description(&self) -> &str { fn description(&self) -> &str {
match *self { match *self {
Error::Api(ref e) => &e.error, Error::Api(ref e) => {
e.error_description.as_ref().unwrap_or(&e.error)
},
Error::Serde(ref e) => e.description(), Error::Serde(ref e) => e.description(),
Error::Http(ref e) => e.description(), Error::Http(ref e) => e.description(),
Error::Io(ref e) => e.description(), Error::Io(ref e) => e.description(),

Loading…
Cancel
Save