## Why is this an issue?

`Throwable` is the superclass of all errors and exceptions in Java. `Error` is the superclass of all errors, which are not meant to be caught by applications.

Catching either `Throwable` or `Error` will also catch `OutOfMemoryError` and `InternalError`, from which an application should not attempt to recover.

### Noncompliant code example

    try { /* ... */ } catch (Throwable t) { /* ... */ }
    try { /* ... */ } catch (Error e) { /* ... */ }

### Compliant solution

    try { /* ... */ } catch (RuntimeException e) { /* ... */ }
    try { /* ... */ } catch (MyException e) { /* ... */ }

## Resources

- CWE - CWE-396 - Declaration of Catch for Generic Exception
- CERT, ERR08-J. - Do not catch NullPointerException or any of its ancestors