<lambda>null1// This file was automatically generated from exception-handling.md by Knit tool. Do not edit. 2 package kotlinx.coroutines.guide.exampleExceptions02 3 4 import kotlinx.coroutines.* 5 6 @OptIn(DelicateCoroutinesApi::class) 7 fun main() = runBlocking { 8 val handler = CoroutineExceptionHandler { _, exception -> 9 println("CoroutineExceptionHandler got $exception") 10 } 11 val job = GlobalScope.launch(handler) { // root coroutine, running in GlobalScope 12 throw AssertionError() 13 } 14 val deferred = GlobalScope.async(handler) { // also root, but async instead of launch 15 throw ArithmeticException() // Nothing will be printed, relying on user to call deferred.await() 16 } 17 joinAll(job, deferred) 18 } 19