Hi all. With 2.0-eap (2.0.0-eap-278), StatusPages ...
# ktor
c
Hi all. With 2.0-eap (2.0.0-eap-278), StatusPages does not seem to catch exceptions occurring during HTML DSL rendering. I saw a git commit fixing the same issue for freemarker, KTOR-343 ( git diff 18222b4e8~ 18222b4e8 ), which I don't fully understand, lacking some knowledge about the 2.0 refactoring; I was wondering if it was the same kind of problem. Also, would the Velocity plugin also be affected?
a
Could you please file an issue with the attached code to reproduce this problem?
c
Ok. But just to confirm, having
install<StatusPages> { cause -> call.respond(io.ktor.http.HttpStatusCode.InternalServerError) }
should be enough to respond 500 if an uncatched exception happens during rendering, right?
a
It should be the following code using Ktor beta:
Copy code
install(StatusPages) {
    exception<Throwable> { call: ApplicationCall, _ ->
        call.respond(HttpStatusCode.InternalServerError)
    }
}
c
Your code seems to only work in 2.0.0-beta-1, not in 2.0.0-eap-278 ; and alas the most recent version of ktor-html-builder on https://maven.pkg.jetbrains.space/public/p/ktor/eap/ is still eap-278
Ah, ok, understood, its name changed to ktor-server-html-builder, sorry
👍 1
The exception is catched, but ktor returns 200 with an empty document. I'll open an issue.