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

Martin Devillers

12/18/2018, 3:13 PM
Me again 🙂 This time I’m confused by some behavior involving
withContext
and
CompletableDeferred
.
This test fails because of the
[Failed]
exception which is thrown by the exception handler (which mimicks the default behavior on the Android platform by causing a crash). By completing a
CompletableDeferred
exceptionally after a timeout waiting for it, the exception gets propagated to the uncaught exception handler. I wouldn’t expect this, given the documentation of
CompletableDeferred.completeExceptionally
Actually, I find it especially strange that the `CompletableDeferred`’s handling of the exception passed in
completeExceptionally
changes simply due to the fact that
await
has been called on it, then cancelled. If
await
isn’t called, then there isn’t any failure.
In case anyone is interested by this, it seems to be the same issue as https://github.com/Kotlin/kotlinx.coroutines/issues/893 (confirmed by testing on the
develop
branch)
6 Views