`async and produce ... are relying on the user to ...
# coroutines
a
async and produce ... are relying on the user to consume the final exception
– what if user doesn’t consume final exception, will it be thrown out of async/produce or just quietely hidden?
g
quietely hidden Someone always should handle Deferred result. Otherwise use launch which do not wrap extensions and just throw them (as threads)
a
Still didn’t get it. If I call
Copy code
myDeferredCourotine.await()
and it throws an exception inside, will I see it?
g
Yes
await() will throw an exception if code inside of myDeferredCourotine threw it
but only when you call await()
in case of launch code will throw just a global uncaught exception, same as any error in a separate thread and you cannot catch it from outside (cannot wrap launch to try or launchedCoroutine.join(), only code inside of launch)