fun main() = runBlocking { supervisorScope { launch(handler) { try { withTimeout(2000) { delay(5000) // triggers the catch while(System.currentTimeMillis() < 5000) {} // doesn't trigger the catch } } catch(te: TimeoutCancellationException) { handle(coroutineContext, te) } } println("Here") } println("Here") }