I am wondering, why cached exception of `await()` ...
# coroutines
n
I am wondering, why cached exception of
await()
still cancels parent job? Let assume this example: https://pl.kotl.in/DlU1vaR2T. If you comment out
await()
part, launch's job will stay active
l
You need a local
coroutineScope
(handling exceptions/errors outside of it).
async
is meant for "paralellization". The goal is to cancel concurrent coroutines of the scope if one fails, so you don't keep doing work that will eventually be dropped. That is structured concurrency benefits… and gotchas. But the efficiency and corectness benefits largely outweigh that gotcha.
n
The problem is well defined in `https://github.com/Kotlin/kotlinx.coroutines/issues/763`: it is easy to miss wrapping async into
coroutineScope
. Wrapping parallelization into local scope looks good approach