News for hackers. Stuff that matters.
Re:Java’s Checked Exceptions Are Evil? (2015) by skybrian on Sunday September 23, 2018 @12:47PM (#18051894)
Typically you don't need to catch at this level of granularity. A generic UnavailableException would cover it. The reasons why a method can fail vary by implementation and you typically don't need to expose this at the API level. It shouldn't be a breaking change for a method to fail for a different reason because the implementation changed.

If you take this approach, there are two kinds of methods: those that always succeed and those that can fail. It's similar to how Go's error type works.

Java is a mess not due to the existence of checked exceptions, but because they created an unfortunate exception hierarchy and that resulted in inconsistent API design where there's no consensus about what to do.

There are no comments on this comment yet.