mp
10/09/2018, 6:28 PMResourceNotFoundException
) that is handled by an exception handler to respond with a 404, and there's a test that this works using withTestApplication
. On ktor-1.0.0-alpha-1, the test fails, seemingly because the exception bubbles up to the test itself.
Interestingly, if I alter the logic to throw RNFE()
directly inside the scope provided by the route (get("/foo")
), everything seems okay: the exception is thrown, handled, and responded to correctly, without crashing the test. However, in practice I have to use some blocking i/o, so I have:
val stuff = async(ioDispatcher) {
// blocking i/o that can throw RNFE
}.await()
and in that configuration, the exception crashes the test. I can see from logging that it is getting to the exception handler as well. Did I screw up structured coroutines (async
is called on the CoroutineScope
from get()
, not global), or is this a bug in the TestEngine
or something?mp
10/09/2018, 6:36 PMioDispatcher
is from newFixedThreadPoolContext