Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumKotlinexception handling in coroutinesSingle-choice MCQ

Why does installing a CoroutineExceptionHandler on the inner coroutine here have no effect (the exception is still treated as uncaught at the top level)?

import kotlinx.coroutines.* suspend fun run() = coroutineScope { launch(CoroutineExceptionHandler { _, _ -> println("inner") }) { throw RuntimeException("x") } }