I went through the documentation of `suspendCancel...
# coroutines
l
I went through the documentation of
suspendCancellableCoroutine
. It mentions that this function throws a
CancellationException
if the coroutine is cancelled or completed while suspended. In which case the coroutine is completed while suspended?
e
This case is not trivial to set up. It never happens if you use coroutine builders from
kotlinx.coroutines
. Take a look at this test that tests for this schenario: https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/common/test/CancellableContinuationTest.kt#L120-L141
🙏 1
l
Thanks @elizarov. This unit test example really helped