about summary refs log tree commit diff
path: root/src/handlers.rs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-04-14T18·29+0200
committerVincent Ambo <github@tazj.in>2018-04-14T20·21+0200
commitea68bac4273895c22282049eb08775baae3154b8 (patch)
treeced589862bc6cbc1e5020308dcd7510a4338fb9e /src/handlers.rs
parent31b0a550f2b96a1de5de65308420788c9a6aa5df (diff)
refactor(handlers): Improve error handling in post creation
Diffstat (limited to 'src/handlers.rs')
-rw-r--r--src/handlers.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/handlers.rs b/src/handlers.rs
index dd1a5007c0bd..33f33deccb87 100644
--- a/src/handlers.rs
+++ b/src/handlers.rs
@@ -165,9 +165,9 @@ pub fn reply_thread(state: State<AppState>,
     };
 
     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))