...
Unchecked exception classes such as Error and its subclasses are not subject to compile-time checking because it is tedious to account for all exceptional conditions and recovery is generally difficult. However, even if recovery is usually possible, or impossible, the JVM allows a graceful exit that logs and a chance to at least log the error is at least feasible. This is made possible by using a try-catch block that catches Throwable. Also, when code must not leak potentially sensitive information, catching Throwable is permitted. In all other cases, catching Throwable is not recommended. Where cleanup operations such as releasing system resources are possible, code should use a finally block and do the needful.
Noncompliant Code Example
...
This compliant solution shows a try-catch block that can be used to capture java.lang.Error or java.lang.Throwable. A log entry can be made at this point and followed by attempts to free key system resources in the finally block.
...