logoalt Hacker News

Mawrlast Tuesday at 11:23 PM1 replyview on HN

I assume you mean languages with exceptions.

You can't bubble up an exception, it's done automatically. That's a very important distinction. You can't make the decision to bubble up or not, because you do not have the required information - you don't know whether an exception can be thrown or not at any point. Therefore, you can't say you're making a decision at all.

Explicit error allows you to be able to make the decision.


Replies

DangitBobbylast Wednesday at 3:00 PM

No. Exceptions means the default is to bubble up. You can always write special handling code to prevent bubbling it up if you want in a language with exceptions.

So it's:

Rely on the programmer to identify that an error was made and in 95% of situations just bubble it up, do something useful 5% of the time, but "deal with" the error 100% of the time OR

Rely on the programmer to identify the 5% of situations where they don't want the error to just bubble up and add special handling for that case specifically.