diff options
Diffstat (limited to 'src/micropub/post.rs')
-rw-r--r-- | src/micropub/post.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/micropub/post.rs b/src/micropub/post.rs index 680f242..7ec3566 100644 --- a/src/micropub/post.rs +++ b/src/micropub/post.rs @@ -158,7 +158,7 @@ async fn new_post<S: Storage>(req: Request<ApplicationState<S>>, body: serde_jso Ok(exists) => if exists { return error_json!(409, "already_exists", format!("A post with the exact same UID already exists in the database: {}", uid)) }, - Err(err) => return error_json!(500, "database_error", err) + Err(err) => return Ok(err.into()) } // WARNING: WRITE BOUNDARY //let mut storage = RwLockUpgradableReadGuard::upgrade(storage).await; @@ -225,7 +225,7 @@ async fn process_json<S: Storage>(req: Request<ApplicationState<S>>, body: serde return error_json!(401, "insufficient_scope", "You need a `delete` scope to delete posts.") } if let Err(error) = req.state().storage.delete_post(&url).await { - return error_json!(500, "database_error", error) + return Ok(error.into()) } return Ok(Response::builder(200).build()); }, @@ -234,7 +234,7 @@ async fn process_json<S: Storage>(req: Request<ApplicationState<S>>, body: serde return error_json!(401, "insufficient_scope", "You need an `update` scope to update posts.") } if let Err(error) = req.state().storage.update_post(&url, body.clone()).await { - return error_json!(500, "database_error", error) + return Ok(error.into()) } else { return Ok(Response::builder(204).build()) } |