]> Untitled Git - lemmy.git/blobdiff - crates/api_crud/src/user/delete.rs
Rework error handling (fixes #1714) (#2135)
[lemmy.git] / crates / api_crud / src / user / delete.rs
index c3977e72614beb7b7642dd2bcb6a2e4f371288b7..ae92c12e32ad9bf9bda1bc4acdf84de4fdce8048 100644 (file)
@@ -35,15 +35,13 @@ impl PerformCrud for DeleteAccount {
     let permadelete = move |conn: &'_ _| Comment::permadelete_for_creator(conn, person_id);
     blocking(context.pool(), permadelete)
       .await?
-      .map_err(LemmyError::from)
-      .map_err(|e| e.with_message("couldnt_update_comment"))?;
+      .map_err(|e| LemmyError::from_error_message(e, "couldnt_update_comment"))?;
 
     // Posts
     let permadelete = move |conn: &'_ _| Post::permadelete_for_creator(conn, person_id);
     blocking(context.pool(), permadelete)
       .await?
-      .map_err(LemmyError::from)
-      .map_err(|e| e.with_message("couldnt_update_post"))?;
+      .map_err(|e| LemmyError::from_error_message(e, "couldnt_update_post"))?;
 
     blocking(context.pool(), move |conn| {
       Person::delete_account(conn, person_id)