Joffrey
05/06/2020, 4:51 PMtry {
doTheThingThatUsuallyGetsStuck()
} catch(e: TimeoutCancellationException) {
fail("some debug information about why the test may have timed out")
}
The problem with this is that sometimes the code under test uses timeouts as well, so this catch block may actually fail the test even in some valid timeout situations. Is there a way for me to transparently add information about the timeout somehow?
If I rethrow a CancellationException
with a custom error message, then how can I catch it upstream and access the message?tseisel
05/06/2020, 5:15 PMCoroutinesTimeout
from kotlinx-coroutines-debug
:
https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-debug/kotlinx.coroutines.debug.junit4/-coroutines-timeout/index.htmlJoffrey
05/06/2020, 5:17 PM