Back to Intellij Community

KotlinCatchMayIgnoreException

plugins/kotlin/code-insight/descriptions/resources-en/inspectionDescriptions/KotlinCatchMayIgnoreException.html

2025.3-rc-2636 B
Original Source

Reports catch blocks that are empty or may ignore an exception.

While occasionally intended, empty catch blocks may complicate debugging. Also, ignoring a catch parameter might be wrong.

The inspection won't report any catch parameters named ignore, ignored, or _.

You can use the quick-fix to change the exception name to _.

Example:

try {
    throwingMethod()
  } catch (ex: IOException) {

  }

After the quick-fix is applied:

try {
    throwingMethod()
  } catch (_: IOException) {

  }

Use the Ignore when 'catch' block contains a comment option to ignore catch blocks with comments.