lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

Merge various `CouldntFindX` errors into one

Open Nutomic opened this issue 1 year ago • 0 comments

We have all sorts of separate error messages for NotFound, such as these:

  CouldntFindCommunity,
  CouldntFindPerson,
  CouldntFindComment,
  CouldntFindCommentReport,
  CouldntFindPostReport,
  CouldntFindPrivateMessageReport,
  CouldntFindLocalUser,
  CouldntFindPersonMention,
  CouldntFindRegistrationApplication,
  CouldntFindCommentReply,
  CouldntFindPrivateMessage,
  CouldntFindActivity,

I dont think there is any reason for them, it would be enough to have a single NotFound error. Particularly after https://github.com/LemmyNet/lemmy/pull/4617 which requires using these errors in a lot more places. That could be simplified by adding a method Option::to_err() which turns it into NotFound error, similar to the way LemmyErrorExt works.

Nutomic avatar Apr 16 '24 12:04 Nutomic