I am throwing a `RuntimeException` in `imageReposi...
# coroutines
l
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
Maybe my blog post may help you out. “Exceptional Exceptions for Coroutines made easy…?” by Anton Spaans https://link.medium.com/G9uBbY3gS2
l
Thanks Anton. Will take a look
k
async
immediately launches the coroutine by default. You can make them lazy by doing something like this
async(start=CoroutineStart.Lazy)