elizarov
09/14/2017, 7:48 AMlaunch
is just like starting a new thread. If the code inside launch
crashes with exception then it is considered “uncaught” exception and, generally, should crash your app (on Android that happens automatically). However, when you use async
and the execution results with exception, then this exception gets stored inside the Deferred
. It is your obligation to process it later. So:
- launch
- fire and forget, crash application on uncaught error;
- async
- launch and await
for result later. You must await
on a coroutine that you’ve created with async
. You MUST NOT forget about the coroutine you’ve started with async.deviant
09/14/2017, 8:17 AMinvokeOnCompletion()
after launch
is finished. or it's not recommended?elizarov
09/14/2017, 12:33 PMCoroutineExceptionHandler
in your context.deviant
09/14/2017, 12:34 PMelizarov
09/14/2017, 12:35 PMdeviant
09/14/2017, 12:36 PMlaunch(UI+myExHandler)
?elizarov
09/14/2017, 12:37 PMdeviant
09/14/2017, 12:38 PMelizarov
09/14/2017, 7:03 PM