Inspectopedia Help

Redundant 'runCatching' call

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


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

After the quick-fix is applied:

fun foo() = run { doSomething() }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Kotlin, @snapshot@

Last modified: 13 July 2023