https://kotlinlang.org logo
#ktor
Title
# ktor
a

Alexander Finn

10/02/2020, 1:15 PM
Hey guys, one thing I’ve noticed since switched to ktor 1.4 (not sure if it was there before as well): when there is a (de)serialization problem during
call.recieve
or
call.respond
- it actually hides the exception and only prints something like this:
INFO Application - 200 OK: GET - /api/v2/announcements, io failed
In the case of deserialization exception during
call.recieve
it returns empty reponse with status 500, in the case of serialization durint
call.respond
it returns empty response with status 200 (and this is even more of a problem). Does it mean that the best practice is to always wrap both method calls with try..catch? Or any configuration option I can enable to make such issues more prominent in the logs and the ways responses are handled?
r

Rustam Siniukov

10/02/2020, 1:28 PM
do you mind creating an issue with a minimal reproduce example?
a

Alexander Finn

10/02/2020, 1:29 PM
Absolutely, will do so as long as you consider this to be an issue.
r

Rustam Siniukov

10/02/2020, 1:37 PM
Returning 200 is definitely an issue. It is possible related to https://youtrack.jetbrains.com/issue/KTOR-835 And there is PR to fix it https://github.com/ktorio/ktor/pull/2088. But it can’t be landed before 1.5 release since it has api change.
a

Alexander Finn

10/02/2020, 1:38 PM
Got it, will look into the existing issue and create a new one if needed.
r

Rustam Siniukov

10/02/2020, 1:38 PM
returning 500 on unhandled exception in request is an expected behaviour
if you will create an issue, please specify engine and serialiser that you use
a

Alexander Finn

10/02/2020, 1:42 PM
yep, for the reference it is netty and jackson
4 Views