From 6d0a4d03705b96b252a6b29d3b8c188b9c903b89 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Mon, 3 Feb 2020 22:55:36 -0500 Subject: Refactor importer to store tasks in postgresql --- src/error.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/error.rs') 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 for Error { impl From for Error { fn from(e: DieselErr) -> Error { - Error::DieselError(e) + match e { + DieselErr::NotFound => Error::NotFound, + e => Error::DieselError(e) + } } } -- cgit v1.2.3