1 // This file was automatically generated from exception-handling.md by Knit tool. Do not edit. 2 package kotlinx.coroutines.guide.exampleSupervision02 3 4 import kotlin.coroutines.* 5 import kotlinx.coroutines.* 6 <lambda>null7fun main() = runBlocking { 8 try { 9 supervisorScope { 10 val child = launch { 11 try { 12 println("The child is sleeping") 13 delay(Long.MAX_VALUE) 14 } finally { 15 println("The child is cancelled") 16 } 17 } 18 // Give our child a chance to execute and print using yield 19 yield() 20 println("Throwing an exception from the scope") 21 throw AssertionError() 22 } 23 } catch(e: AssertionError) { 24 println("Caught an assertion error") 25 } 26 } 27