elizarov
04/20/2017, 7:51 AMjob.cancel
the next cancellable suspending function that you invoke will throw CancellationException
. All suspending functions in kotlinx.coroutines
are cancellable and they all mention this behavior in their docs. So, launch
coroutine builder has a handler for uncaught exception (similarly to uncaught exception in threads) and it does ignore CancellationException
, so you should too. More on the logic for handling uncaught exceptions in coroutines can be found here: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.experimental/handle-coroutine-exception.html