Back to Intellij Community

RedundantRunCatching

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

2025.3-rc-2272 B
Original Source

Reports runCatching calls that are immediately followed by getOrThrow. Such calls can be replaced with just run.

Example:

fun foo() = runCatching { doSomething() }.getOrThrow()

After the quick-fix is applied:

fun foo() = run { doSomething() }