JakeWharton/retrofit2-kotlin-coroutines-adapter

[Question] Retrieving Error response body

Closed this issue · 2 comments

When a network error occurs, something like a HTTP 400 error. Is there any way to get access to the error response body ? I need access to the custom error msg being sent in the error body.

Never mind, looking at the source helped. Thanks !

For all others : You can return the type Deferred<Response > and get access to the response object.

you can check exception type and get error body

if you don't want to use Deferred