lemmy icon indicating copy to clipboard operation
lemmy copied to clipboard

Don't ignore all errors in implementations of `from_json` method

Open dullbananas opened this issue 8 months ago • 3 comments

For example, in impl Collection for ApubCommunityFeatured, an error for a single item is always ignored using filter_map instead of being returned. Some or all errors (at least errors related to database) should be returned, even if it involves checking which error type it is.

dullbananas avatar May 16 '25 00:05 dullbananas

What do you propose to do exactly? Sure we could use try_join_all to return an error if a single post fails to fetch but that doesnt make sense. Its possible that this post was removed or there is a random network error, but we can still fetch all the other posts. If theres a database error it will also be noticable from other queries. We can of course log errors for failed requests, but that gets extremely noisy in production.

Nutomic avatar May 16 '25 11:05 Nutomic

It's mostly useful for a retry loop, which would rely on the ok/err status, and should be added if there isn't one already. Also, the different behavior that's caused by the lack of early return might be weird sometimes.

I don't know if there's any error types that need to be ignored. If there are, then the conditional logic on the error type must be precise enough to not ignore any error for which it makes sense to retry.

dullbananas avatar May 23 '25 21:05 dullbananas

We generally dont retry any http fetches. That was implemented in the past but caused more problems than its worth. See https://github.com/LemmyNet/lemmy/pull/2866 https://github.com/LemmyNet/lemmy/issues/2865

Nutomic avatar May 26 '25 10:05 Nutomic