Checked Exceptions Debate

Cluster focuses on debates about the pros and cons of checked exceptions in Java, comparing them to unchecked exceptions, error codes, and alternatives like Rust's Result types.

📉 Falling 0.5x Programming Languages
4,560
Comments
20
Years Active
5
Top Authors
#6619
Topic ID

Activity Over Time

2007
6
2008
24
2009
66
2010
30
2011
96
2012
177
2013
169
2014
141
2015
168
2016
227
2017
174
2018
294
2019
290
2020
517
2021
279
2022
449
2023
525
2024
460
2025
428
2026
40

Keywords

JVM SQL JS RAII RuntimeExceptions NET baeldung.com OutOfMemoryException FileNotFoundException ArrayIndexOutOfBoundsException exceptions checked exceptions checked java error exception handling error handling code unchecked

Sample Comments

neonsunset May 17, 2025 View on HN

Let's revisit past conversations:- https://news.ycombinator.com/item?id=43226624- https://news.ycombinator.com/item?id=43584056- https://news.ycombinator.com/item?id=36736326And more. I'm not sure what you fo

storedbox Sep 11, 2020 View on HN

Checked exceptions are hardly Java's biggest mistake.

quotemstr Nov 26, 2024 View on HN

Checked exceptions are more trouble than they're worth. That doesn't make exceptions in general bad.

MattPalmer1086 Sep 18, 2021 View on HN

Java has checked exceptions, but everyone seems to hate them.

skybrian Sep 20, 2018 View on HN

Worse than checked exceptions (Java)? How about unchecked exceptions?

aidenn0 Nov 8, 2019 View on HN

Java did a shitty job of checked exceptions. C++ did worse.

johnyzee Sep 9, 2011 View on HN

I like checked exceptions because you can't not deal with the error condition. Swallowed exceptions is a code smell that any half-decent developer will notice, whereas failing to check for some return value is much more subtle. Java allows you to have both, since you can design your exceptions as unchecked, or rethrow a checked exception wrapped in a runtime exception.

jrpelkonen Oct 18, 2022 View on HN

Agreed, checked exceptions surface potential errors to the caller. In that regard Java fares better. However, handling exceptions still require a separate catch clause rather than being part of the normal flow. Furthermore, it is nigh impossible to rely on checked exceptions alone, most Java code may throw RuntimeExceptions such as NullPointerException or ArrayIndexOutOfBoundsException and there is no way to know it by just looking at the calling code.

wvenable Sep 17, 2009 View on HN

The difference between error codes and exceptions are that, for error codes, you must check the result of every function call and method and in some way handle that result. Contrast this to exceptions, where the advantage is that your error handling is centralized. You should throw as much as necessary and catch in a few key places.Checked exceptions ruins that advantage of exceptions -- you're back to writing a whole bunch of buggy error handling code rather than just a few key catches. T

recursive Oct 9, 2025 View on HN

So you think java's checked exceptions are a better model? No opinion myself, but that way seems widely considered bad too.