simplify / unify error handling

We want to return a Result<Blog>, instead of a QueryResult<Blog>.
We can use map_err() to map it to the desired error type.

thanks to review from @BaptisteGelez & @fdb-hiroshima.
This commit is contained in:
Igor Galić
2019-05-28 17:54:01 +02:00
committed by Igor Galić
parent a0aef50674
commit 6253adf768
2 changed files with 3 additions and 8 deletions
-6
View File
@@ -14,12 +14,6 @@ impl From<Error> for ErrorPage {
}
}
impl From<diesel::result::Error> for ErrorPage {
fn from(err: diesel::result::Error) -> ErrorPage {
ErrorPage(plume_models::Error::Db(err))
}
}
impl<'r> Responder<'r> for ErrorPage {
fn respond_to(self, req: &Request) -> response::Result<'r> {
let rockets = req.guard::<PlumeRocket>().unwrap();