]> Untitled Git - lemmy.git/blobdiff - crates/api_crud/src/comment/read.rs
Rework error handling (fixes #1714) (#2135)
[lemmy.git] / crates / api_crud / src / comment / read.rs
index 56584fc37bf0d2b1040df58432ffa7fe6631c82a..77ef1f962e88801bbe7fc88324808bec29f23246 100644 (file)
@@ -41,8 +41,7 @@ impl PerformCrud for GetComment {
       CommentView::read(conn, id, person_id)
     })
     .await?
-    .map_err(LemmyError::from)
-    .map_err(|e| e.with_message("couldnt_find_comment"))?;
+    .map_err(|e| LemmyError::from_error_message(e, "couldnt_find_comment"))?;
 
     Ok(Self::Response {
       comment_view,
@@ -103,8 +102,7 @@ impl PerformCrud for GetComments {
         .list()
     })
     .await?
-    .map_err(LemmyError::from)
-    .map_err(|e| e.with_message("couldnt_get_comments"))?;
+    .map_err(|e| LemmyError::from_error_message(e, "couldnt_get_comments"))?;
 
     // Blank out deleted or removed info
     for cv in comments