Inspectopedia
 
2024.3

Prohibited 'Exception' caught

Warning
New
Last modified: 03 December 2024

Reports catch clauses that catch an inappropriate exception.

Some exceptions, for example java.lang.NullPointerException or java.lang.IllegalMonitorStateException, represent programming errors and therefore almost certainly should not be caught in production code.

Example:

Use the Prohibited exceptions list to specify which exceptions should be reported.