top | item 43253240

(no title)

daveliepmann | 1 year ago

>Exceptional circumstances, or exceptions for short, mean "things aren't working as expected due to programmer error".

Interesting. In Javaland this describes assertions, and the term exception is for operating errors, i.e. problems not necessarily attributable to programmer error, including your example of a network failure.

discuss

order

ignoramous|1 year ago

> In Javaland this describes assertions, and the term exception is for operating errors, i.e. problems not necessarily attributable to programmer error

Making matters more confusing in Javaland, Errors are separate from Exceptions, but both are Throwables.

  An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch. Most such errors are abnormal conditions. The ThreadDeath error, though a "normal" condition, is also a subclass of Error because most applications should not try to catch it.
https://docs.oracle.com/javase/8/docs/api/java/lang/Error.ht... / https://archive.vn/i5F7B

PeeMcGee|1 year ago

This reminds me of one of my favorite SO answer-rants that reads like an angry Dr. Seuss rhyme: https://stackoverflow.com/a/36627158

> Which of these are the "checked" exceptions? Throwables are checked exceptions, except if they're also Errors, which are unchecked exceptions, and then there's the Exceptions, which are also Throwables and are the main type of checked exception, except there's one exception to that too, which is that if they are also RuntimeExceptions, because that's the other kind of unchecked exception.

chuckadams|1 year ago

Errors are not checked, the assumption being that most of the time you can’t do anything about them anyway.