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

liminal

12/31/2019, 6:56 PM
I am throwing a
RuntimeException
in
imageRepository.downloadImage("img-url-3")
only when getting
image3
. Since i am not calling
await()
on it, i was expecting the exception to go unnoticed and not propagate to default
CoroutineExceptionHandler
and not crash my app. Yet the app crashes still. can someone explain what is different about exception handling when
await()
is called vs when it is not? thanks!
s

streetsofboston

12/31/2019, 7:05 PM
Maybe my blog post may help you out. “Exceptional Exceptions for Coroutines made easy…?” by Anton Spaans https://link.medium.com/G9uBbY3gS2
l

liminal

12/31/2019, 7:15 PM
Thanks Anton. Will take a look
k

Kroppeb

01/01/2020, 12:21 PM
async
immediately launches the coroutine by default. You can make them lazy by doing something like this
async(start=CoroutineStart.Lazy)