Open anox1337 opened 1 month ago
Hey @anox1337, getOrThrow
always throws an exception if the respond is not the properly backed. You can use getOrNull
instead in this situation.
Hello @skydoves ,
in my opinion the response was properly defined.
In that call I am expecting ApiResponse<ErrorResponse?> . The Questionmark indicates that the returntype may or may not be filled. As I received a successful response (code 204) with no body, I would not expect an exception to be thrown. And this behaves as expected on android. But on iPhones this seems to work differently which has me stomped.
What would you suggest I should use to define a response that has an optional body?
Please complete the following information:
Describe the Bug: NullPointerException gets thrown on iOS but not on Android.
Hello!
I call an Endpoint where I may get an ErrorResponse, but not always. Looks like this:
See the ErrorResponse is optional.
When calling the Endpoint:
It throws the Nullpointer:
What I would expect is that getOrThrow would return a NULL object, signaling me that the Api Call was successful but no Response object was available. This is exactly how it works on Android.
Am I missing something?
Thank you for your help :)