diff options
author | Vincent Ambo <tazjin@gmail.com> | 2018-04-14T18·29+0200 |
---|---|---|
committer | Vincent Ambo <github@tazj.in> | 2018-04-14T20·21+0200 |
commit | ea68bac4273895c22282049eb08775baae3154b8 (patch) | |
tree | ced589862bc6cbc1e5020308dcd7510a4338fb9e | |
parent | 31b0a550f2b96a1de5de65308420788c9a6aa5df (diff) |
refactor(handlers): Improve error handling in post creation
-rw-r--r-- | src/handlers.rs | 4 |
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)) |