As a guideline, exceptions that are output in situations where the caller can return are checked exceptions. Unchecked exceptions that cannot be restored.
If it is not possible to determine whether or not recovery is possible, it should be a non-inspection exception. (Explaned in item71)
The Error class is customarily output by the JVM when resources are scarce, and it is unlikely that a programmer will create a subclass of Error. Therefore, of the unchecked exceptions, only RuntimeException can be implemented.
Do not define exceptions that directly inherit Throwables. There is no benefit to not inheriting checked exceptions and it confuses the user.
Recommended Posts