3 ms·
My main gripe with checked exceptions is they create a whole other possible code path on each `catch` clause. I tend to keep checked exceptions to the absolute
by piva00 2y ago
My main gripe with checked exceptions is they create a whole other possible code path on each `catch` clause. I tend to keep checked exceptions to the absolute minimum where they actually make sense, all the rest are RuntimeExceptions that should bubble up the stack.
- LinXitoW 2y agoBut so would every single other method to react to different types of errors, no? In something like go, you're even required to create the separate code path for EVERY SINGLE erroring line, even if your intention is simply to bubble it up.
- KarlKode 2y agoThat's kind of how you do it in go. Either: 1. Bubble up error (as is/wrapped/different error. 2. Handle error & have a (possibly complex) new code path. There's also the panic/recover that sometimes is misused to emulate exceptions.
- layer8 2y agoThey don’t create any other code paths than RuntimeExceptions.