It makes a copy of the exception, which seems to be a bit of an inexact art
s
simon.vergauwen
05/18/2024, 7:53 AM
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
Youssef Shoaib [MOD]
05/18/2024, 8:34 AM
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
Youssef Shoaib [MOD]
05/18/2024, 8:43 AM
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