You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just tested your adapter, but when calling a end-point which returns a 404 I'm not getting the converted error object back in the NetworkResponse.ServerError() (body is always null).
<-- 404 https://api.themoviedb.org/4/discover/movies?sort_by=popularity.desc (126ms)
date: Fri, 18 Oct 2019 11:49:09 GMT
content-type: application/json;charset=utf-8
...
{"status_code":34,"status_message":"The resource you requested could not be found.","success":false}
<-- END HTTP (100-byte body)
And the logged response:
ServerError(body=null, code=404, headers=[snipped for brevity])
The text was updated successfully, but these errors were encountered:
almeric
changed the title
Unsuccesfull responses don't return converted error object
Unsuccessful responses don't return converted error object
Oct 18, 2019
Thank you for filing this bug. It does appear that the NetworkResponseCall class does not handle the ServerError case correctly. But since this issue is related to this class only, the problem is only confined to suspend methods. Methods using the Deferred return type should continue to work for now.
I'll fix this error and add tests to make sure this does not resurface in the future.
Hi,
Just tested your adapter, but when calling a end-point which returns a 404 I'm not getting the converted error object back in the NetworkResponse.ServerError() (
body
is always null).It looks like here https://github.com/haroldadmin/NetworkResponseAdapter/blob/master/src/main/kotlin/com/haroldadmin/cnradapter/NetworkResponseCall.kt#L22 it will always return a
null
body, and the actual error inResponse.errorBody
is ignored.Also isn't it better to check if the
Response
is succesfull by usingresponse.isSuccessful
?I think the following (lines 19-23 in NetworkResponseCall):
could be replaced with something like this (note
response.extractError
doesn't exist yet) :An example of a failed request:
And the logged response:
The text was updated successfully, but these errors were encountered: