Catching Exceptions In Kotlin Coroutines
Problem In your opinion, what should be the result of the following piece of Kotlin code? fun main() { runBlocking { try { async { throw Exception() }.await() } catch (_: Exception) { println("Exception caught") } delay(1.seconds) println("Not cancelled") } } Exception caught Not cancelled Exception in thread "main" java.lang.Exception <<< crash >>> Exception caught Exception in thread "main" java.lang.Exception <<< crash >>> Well, you might be surprised to know that it is niether 1 nor 2 but 3....