From ea68bac4273895c22282049eb08775baae3154b8 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 14 Apr 2018 20:29:46 +0200 Subject: refactor(handlers): Improve error handling in post creation --- src/handlers.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/handlers.rs b/src/handlers.rs index dd1a5007c0..33f33deccb 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -165,9 +165,9 @@ pub fn reply_thread(state: State, }; state.db.send(CreatePost(new_post)) + .flatten() .from_err() - .and_then(move |res| { - let post = res?; + .and_then(move |post| { info!("Posted reply {} to thread {}", post.id, post.thread_id); Ok(HttpResponse::SeeOther() .header("Location", format!("/thread/{}#post-{}", post.thread_id, post.id)) -- cgit 1.4.1