ktor-1.0.0-alpha-1 quirk: I have an endpoint that ...
# ktor
m
ktor-1.0.0-alpha-1 quirk: I have an endpoint that throws an exception (my own
ResourceNotFoundException
) 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:
Copy code
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?
ioDispatcher
is from
newFixedThreadPoolContext