refactor(handlers): Improve error handling in post creation
This commit is contained in:
parent
31b0a550f2
commit
ea68bac427
1 changed files with 2 additions and 2 deletions
|
@ -165,9 +165,9 @@ pub fn reply_thread(state: State<AppState>,
|
||||||
};
|
};
|
||||||
|
|
||||||
state.db.send(CreatePost(new_post))
|
state.db.send(CreatePost(new_post))
|
||||||
|
.flatten()
|
||||||
.from_err()
|
.from_err()
|
||||||
.and_then(move |res| {
|
.and_then(move |post| {
|
||||||
let post = res?;
|
|
||||||
info!("Posted reply {} to thread {}", post.id, post.thread_id);
|
info!("Posted reply {} to thread {}", post.id, post.thread_id);
|
||||||
Ok(HttpResponse::SeeOther()
|
Ok(HttpResponse::SeeOther()
|
||||||
.header("Location", format!("/thread/{}#post-{}", post.thread_id, post.id))
|
.header("Location", format!("/thread/{}#post-{}", post.thread_id, post.id))
|
||||||
|
|
Loading…
Reference in a new issue