Closed twyatt closed 6 years ago
One strategy for deserializing an error response is outlined in https://github.com/square/retrofit/issues/1454#issuecomment-170291423.
Unfortunately, when awaitResult returns a Result.Error, retrofit2.Response.raw() is used:
awaitResult
Result.Error
retrofit2.Response.raw()
https://github.com/gildor/kotlin-coroutines-retrofit/blob/16a1641fa1122f68e8ad9646c265958f02e5690e/src/main/kotlin/ru/gildor/coroutines/retrofit/CallAwait.kt#L86
So there is no way to access the retrofit2.Response.errorBody().
retrofit2.Response.errorBody()
My apologies, I overlooked the fact that you pass back the retrofit2.Response in the HttpException.
retrofit2.Response
HttpException
One strategy for deserializing an error response is outlined in https://github.com/square/retrofit/issues/1454#issuecomment-170291423.
Unfortunately, when
awaitResult
returns aResult.Error
,retrofit2.Response.raw()
is used:https://github.com/gildor/kotlin-coroutines-retrofit/blob/16a1641fa1122f68e8ad9646c265958f02e5690e/src/main/kotlin/ru/gildor/coroutines/retrofit/CallAwait.kt#L86
So there is no way to access the
retrofit2.Response.errorBody()
.