diff options
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/error.rs b/src/error.rs index 4ae2995..75a7568 100644 --- a/src/error.rs +++ b/src/error.rs @@ -67,6 +67,7 @@ pub enum Error { CommunicationError(reqwest::Error), ParseError(serde_json::error::Error), StravaApiError(StravaApiError), + UnexpectedJson(Value), AlreadyExists, NotFound, InternalError, @@ -79,6 +80,7 @@ impl fmt::Display for Error { Error::PasswordError(ref e) => e.fmt(f), Error::CommunicationError(ref e) => e.fmt(f), Error::ParseError(ref e) => e.fmt(f), + Error::UnexpectedJson(_) => f.write_str("UnexpectedJson"), Error::StravaApiError(ref e) => e.fmt(f), Error::AlreadyExists => f.write_str("AlreadyExists"), Error::NotFound => f.write_str("NotFound"), @@ -107,7 +109,10 @@ impl From<reqwest::Error> for Error { impl From<DieselErr> for Error { fn from(e: DieselErr) -> Error { - Error::DieselError(e) + match e { + DieselErr::NotFound => Error::NotFound, + e => Error::DieselError(e) + } } } |