News for hackers. Stuff that matters.
Re:Error Handling Patterns by golergka on Thursday May 04, 2023 @06:31AM (#35813385)
Depends on where do you want to handle a particular error.

For errors that you can handle right in the calling function, this is ideal.

For errors that should kill your whole aapp, may be do some housekeeping (like abort the whole transaction that wraps your logic to reply to this http request) and get reported to sentry, catching exceptions at some highest level is far more usable.

I prefer to use both depending on meaning of the error.

Re:Error Handling Patterns by AnimalMuppet on Thursday May 04, 2023 @08:37AM (#35814306)
I don't like your approach. In general, I'm a fan of "use the right tool for the job". But for error handling, I prefer one approach for the whole application. If you mix approaches (exceptions here and sum types there), you tend to get bugs at the seams between the regions. If you mix them more uniformly in the code, that tends to be uniformly harder to reason about.
Re:Error Handling Patterns by golergka on Thursday May 04, 2023 @12:29PM (#35818050)
Interesting point. What would you consider to be the seam between regions in this case?