this post was submitted on 23 Jan 2024
363 points (96.7% liked)

Fediverse

28525 readers
348 users here now

A community to talk about the Fediverse and all it's related services using ActivityPub (Mastodon, Lemmy, KBin, etc).

If you wanted to get help with moderating your own community then head over to [email protected]!

Rules

Learn more at these websites: Join The Fediverse Wiki, Fediverse.info, Wikipedia Page, The Federation Info (Stats), FediDB (Stats), Sub Rehab (Reddit Migration), Search Lemmy

founded 2 years ago
MODERATORS
 

Seems like an interesting effort. A developer is building an alternative Java-based backend to Lemmy's Rust-based one, with the goal of building in a handful of different features. The dev is looking at using this compatibility to migrate their instance over to the new platform, while allowing the community to use their apps of choice.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 1 points 10 months ago (1 children)

But like, what kind of error are you gonna handle that's coming from the DB, if it's something like a connection error because the DB is down, then you are shit out of luck you can't handle that anyway, and you probably shouldn't, not from the layer you are calling your DB from, that's a higher level logic, so bubbling Errors there make sense.

and if it's an "error" like findById doesn't always return something, that's what the Optional pattern is for.

what you have described to me seems like a worse version of the checked/unchecked exception system.

[โ€“] [email protected] 1 points 10 months ago

But like, what kind of error are you gonna handle that's coming from the DB, if it's something like a connection error because the DB is down

I could return 500 (getting Error) instead of 404 (getting None) or 200 (getting Some(results)) from my web app.

Or DB just timed out. The code that did the query is very likely the only code that can reasonably decide to retry for example.