https://kotlinlang.org logo
#coroutines
Title
# coroutines
b

bdawg.io

10/30/2018, 12:14 AM
If you're going to immediately
await
on an
async
job, you might as well just use
withContext
a

abhi

10/30/2018, 12:17 AM
This was just from one of the examples simple smile I guess it does make sense to use withContext in this particular case, but we were just trying to understand where async throws it's exceptions
g

gildor

10/30/2018, 1:48 AM
In this case
async
actually makes a lot of difference, because crash on async cancels parent job. Replace coroutineScope with supervisorScope and it will work as you expecting
a

abhi

10/30/2018, 1:53 AM
Ah. Thank you so much! 🙂 That clears it up for me
g

gildor

10/30/2018, 1:54 AM
Yeah, check SupervisorJob part of guide it’s pretty clear how this works by default
3 Views