On Thu, Jun 29, 2023 at 10:48 AM Gilles Sadowski <gillese...@gmail.com> wrote:

> The situation is recoverable from the caller's POV, by performing a
> *new* call, with a correct argument.  We certainly don't need a special
> kind of exception[1] to handle this situation.  What's wrong with catching
> a "RuntimeException" if you know how to try again?
>

The problem isn't with catching a RuntimeException. The problem is
with *not* catching the RuntimeException because the compiler doesn't
make you do this, and the programmer forgets.

Checked exceptions are for cases that SHOULD have an error handler,
and simply makes the omission of one an easy-to-fix compile time error
instead of a hard-to-fix runtime error.

If the code in question shouldn't have an error handler, typically
because the code in question is buggy and should be fixed so that the
exception is never thrown in the first place, then a runtime exception
is appropriate.

-- 
Elliotte Rusty Harold
elh...@ibiblio.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to