Is there a known issue that `withContext` seems to...
# coroutines
y
Is there a known issue that
withContext
seems to remove suppressed exceptions?
s
I haven't seen this exact issue but it sounds similar to issues I've had with stacktrace recovery: https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/topics/debugging.md#stacktrace-recovery-machinery
It makes a copy of the exception, which seems to be a bit of an inexact art
s
Yes, that's very likely it! Possibly only visible from tests, or debugging due to the
-ea
flag and KotlinX Coroutines Debug kicks in automatically on that by default, unless explicitly set to false in the enviroment
y
That makes sense! In the meantime, I'm throwing the exception outside of
withContext
just to be safe. I'll try to make a reproducer and report this
Seems like this is by design:
Note that suppressed exceptions are not copied and are left intact in the cause in order to prevent cycles in the exceptions chain, obscure[CIRCULAR REFERENCE] messages and even crashes in some frameworks