mingkangpan
01/18/2019, 9:01 AMcoroutineScope(UI) {
try {
val a = async(IO) {
delay(1000)
println("Done after delay")
}
val b = async(IO) { throw Exception() }
awaitAll(a, b)
} catch (e: Exception) {
println("Caught $e")
}
}
^ why does this crash my application?
why is the exception not propagated to the outer try & catch
?gildor
01/18/2019, 9:02 AMmingkangpan
01/18/2019, 9:03 AMgildor
01/18/2019, 9:03 AMgildor
01/18/2019, 9:03 AMgildor
01/18/2019, 9:03 AMgildor
01/18/2019, 9:04 AMgildor
01/18/2019, 9:04 AMgildor
01/18/2019, 9:05 AMmingkangpan
01/18/2019, 9:13 AMgildor
01/18/2019, 9:15 AMgildor
01/18/2019, 9:15 AMgildor
01/18/2019, 10:20 AMlouiscad
01/18/2019, 11:08 AMtry {
coroutineScope {
val a = async(<http://Dispatchers.IO|Dispatchers.IO>) {
delay(1000)
println("Done after delay")
}
val b = async(<http://Dispatchers.IO|Dispatchers.IO>) {
throw Exception()
}
awaitAll(a, b)
}
} catch (e: Exception) {
println("Caught $e")
}
mingkangpan
01/18/2019, 11:13 AMscope(IO) {
async { }
async { }
}
vs
scope {
async(IO) { }
async(IO) { }
}
gildor
01/18/2019, 11:14 AMgildor
01/18/2019, 11:15 AMmingkangpan
01/18/2019, 11:54 AMgildor
01/20/2019, 11:38 AM