Why is awaitAll error handling so counter-intuitive?
I’m noticing some counter-intuitive error-handling behavior when using awaitAll. For example:
suspend fun main(): Unit = coroutineScope {
val deferred = async { throw Exception("fake") }
try {
listOf(deferred).awaitAll()
} catch (e: CancellationException) {
println("CancellationException: $e")
} catch (e: Throwable) {
println("Throwable: $e")
}
}
This is caught in the first catch, but if I replace listOf(deferred).awaitAll() with just deferred.await(), then the...