travis
03/31/2018, 12:36 AMTimeoutCancellationException
is being used as a signal for cancelling the parent Coroutine context, so the exception message (and stacktrace) are suppressed?Vsevolod Tolstopyatov [JB]
04/01/2018, 10:29 AMTimeoutCancellationException
is used to cancel timeouted coroutine and its parent, but its not suppressed, it’s just not handled in your case.
Job
is fire and forget, but you still can handle exception (asynchronously) using Job#invokeOnCompletion
. Or you can use async
and call await
on it, then exception will be propagated to call siteVsevolod Tolstopyatov [JB]
04/01/2018, 10:30 AMlaunch {
Test().run()
println("after run()")
}.invokeOnCompletion { it?.apply { println(it) } }
Will print kotlinx.coroutines.experimental.TimeoutCancellationException: Timed out waiting for 1 SECONDS
travis
04/01/2018, 9:23 PM