Closed vhontar closed 2 months ago
Thanks for the explanation! You say the app crashes, is that really the case? Because we had everything wrapped here in a try catch? Or was the problem that we don't reach the interceptors?
I also don't like thst we construct an empty ErrorBody. In higher level modules we might think that backend sends us an empty body. Would it make sense to try to parse a nullable ErrorBody instead? And put a null ErrorBody to the interceptors? Would this make more sense? 🤔
No, it doesn't crash because of the try/catch, but parser itself crashes. Because there is empty body or null body sent by backend.
I'd assume that .body<ApiBodyError?>
will work here 🤔
We need unit tests here: https://github.com/ioki-mobility/kmp-passenger-api/issues/22
@StefMa Thank you for the question!
No, we are still interested in even empty body, because sometimes we need only status code from API. Unfortunately it crashes in parsing if we try to parse empty ApiErrorBody and it just stops the execution. Interceptors wouldn’t get anything.
But we still need status code for some interceptors only.
It was a bug for some interceptors for me in the application, that we don’t receive any interceptions if this body was empty.
Does it make sense? :)