Inspectopedia 2025.2 Help

'throw' inside 'catch' block which ignores the caught exception

Reports exceptions that are thrown from inside catch blocks but do not "wrap" the caught exception.

When an exception is thrown in response to an exception, wrapping the initial exception prevents losing valuable context information, such as stack frames and line numbers.

Example:

... catch (IOException e) { closeAllConnections(); throw new ConnectException("Connection problem."); // warning: 'throw' inside 'catch' block ignores the caught exception 'e' }

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

ThrowInsideCatchBlockWhichIgnoresCaughtException
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Java | Error handling

Configure the inspection:

  • Use the Ignore if result of exception method call is used option to indicate whether the inspection should ignore exceptions whose argument is the result of a method call on the original exception, such as getMessage().

  • Use the Ignore if thrown exception cannot wrap an exception option to ignore throw statements that throw exceptions without a constructor that accepts a Throwable cause.

Inspection options

Here you can find the description of settings available for the 'throw' inside 'catch' block which ignores the caught exception inspection, and the reference of their default values.

Ignore if result of exception method call is used

Default value:

Not selected
Ignore if thrown exception cannot wrap an exception

Default value:

Not selected

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection ThrowInsideCatchBlockWhichIgnoresCaughtException

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2025.2, Qodana for JVM 2025.2,

Last modified: 18 September 2025