Inspectopedia
 
2024.3

Prohibited exception declared

Warning
New
Last modified: 03 December 2024

Reports methods that declare an inappropriate exception in their throws clause. For example an exception can be inappropriate because it is overly generic, such as java.lang.Exception or java.lang.Throwable.

Example:

Configure the inspection:

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

  • Use the Ignore exceptions declared on methods overriding a library method option to ignore exceptions declared by methods that override a library method.