I think I follow. However, it appears I can also g...
# coroutines
l
I think I follow. However, it appears I can also get the thrown exception (from within the coroutine) with
getCancellationException().cause
. But what you're saying is that this is indistinguishable from the
cancel(e)
case right? Meaning:
Copy code
val ex = Exception()
val job1 = launch { delay(1000); throw ex }
val job2 = launch { delay(1000); throw ex }
job2.cancel(ex)
runBlocking { job1.join(); job2.join() }
assert(job1.getCancellationException().cause === job2.getCancellationException().cause)
// No other way to distinguish job1 & job2 termination reasons