Hey, I'm having some trouble with kotlinx.serialization, I defined a class to deserialize a request, annotated it with Serializable and then from inside a route I'm calling call.receiveOrNull<MyRequest>()
But insted of null I'm getting an exception when the request is bad formed. Is this the expected behavior? And if yes what's the point of receiveOrNull?
Enrico Saggiorato
03/05/2022, 2:01 PM
I was also trying to handle exceptions, but it seems like kotlinx.serialization exceptions are internal, so I can only catch Exception? Is there some way to differentiate between the errors?
behavior logic. There is the SerializationException that is the only public exception class. Unfortunately, there is no way to differentiate kotlinx.serialization library errors.
e
Enrico Saggiorato
03/05/2022, 7:25 PM
hey, thanks for the answer! I don't know enough about networking to think about an example for negotiation failing... anyway, am I doing it right? Do I have to catch exceptions in order to handle the bad requests?