Dariusz Kuc
08/16/2019, 8:16 PMawaitAll
will throw first encountered exception
Is there a better way than
val results: List<Deferred<Any>> = ... // whatever
results.joinAll()
for (result in results) {
val error = result.getCompletionExceptionOrNull()
if (error != null) {
// handle error
} else {
result.await()
}
}
louiscad
08/16/2019, 8:38 PMcoroutineScope { … }
inside which you start your `async`/`launch` child coroutines, or you handle errors inside the `async`/`launch` blocks themselves, recovering and letting other coroutines of the scope continue to execute.Dariusz Kuc
08/16/2019, 9:03 PMtry/catch
within async
block should do the trick, then i can just do awaitAll()