Methods are forbidden from throwing to throw RuntimeException
or Exception
. Handling these exceptions requires catching RuntimeException
, which is forbidden in guideline EXC14-J. Catch specific exceptions rather than the more general RuntimeException or Exception. Moreover, throwing a RuntimeException
can lead to subtle errors, for instance, a caller cannot examine the exception to determine why it was thrown, and consequently cannot attempt recovery.
...