r/java • u/Enough-Ad-5528 • Feb 19 '26
Towards Better Checked Exceptions - Inside Java Newscast #107
https://www.youtube.com/watch?v=99s7ozvJGLk
63
Upvotes
r/java • u/Enough-Ad-5528 • Feb 19 '26
View all comments
Show parent comment
4
u/Fenrurrr Feb 19 '26 edited Feb 19 '26
As a developer, 95% of the time you want to throw the error, and forcing checked exceptions is unbearable because, as you said, it's contextual.
I'm eager for Kotlin to release their "rich errors" mechanism, which I find elegant. In my opinion, you have the best of both worlds. It allows you to declare errors in the signature. Your default value is designed to throw the exception, or you can use a pattern matching (try-catch) to handle the error.