https://kotlinlang.org logo
#coroutines
Title
# coroutines
d

David Glasser

08/21/2019, 5:56 PM
Also I'm a bit confused about the implementation of
supervisorScope
. (Lots of questions this morning!)
JobSupport.childCancelled
claims that it has this invariant:
Copy code
* Invariant: never returns `false` for instances of [CancellationException], otherwise such exception
     * may leak to the [CoroutineExceptionHandler].
but SupervisorCoroutine's override always returns false, even for CancellationException? Mostly I'm trying to understand if with CoroutineExceptionHandler/supervisorScope I need my handler to ignore CancellationException. (I think the answer appears to be no from my tests — the CEH never gets the CancellationException, right?)
v

Vsevolod Tolstopyatov [JB]

08/22/2019, 8:34 AM
The implementation relies heavily on internal details and contracts that we do not expose. KDoc for such internal API is written mostly to simplify our own reasoning about the code and sometimes is outdated (like in this case 🙂)
Answering the original question, CEH never gets cancellation exceptions
6 Views