News for hackers. Stuff that matters.
Re:Code Design Decision – Always throw custom exceptions by vbezhenar on Monday December 19, 2022 @11:00PM (#34061382)
If the database is unresponsive, I would prefer to return 5xx to the caller as soon as possible. May be this service is not so important and it's better to present to user an incomplete page rather than waiting for hours or days until database is available.

If it is important, caller will call the service until he got response.

Again: fail fast. Even in distributed systems. Unless you're 100% sure that you know better how to handle this particular issue.

Re:Code Design Decision – Always throw custom exceptions by eweise on Tuesday December 20, 2022 @12:45AM (#34062029)
Totally agree about returning a 5XX error. In my app that would be a single RetryableException back to the caller instead of the internal db error.
Re:Code Design Decision – Always throw custom exceptions by hbrn on Tuesday December 20, 2022 @04:59PM (#34073278)
Ugh. You should never call something "RetryableException".

1. You are in no position to decide for your customer whether exception is "Retryable".

2. For cases where you are in that position, you should just retry automatically.

3. RetryableException tells absolutely nothing about what happened. It's no better than raising MondayException for exceptions that happen on Monday.