Return the actual error body as a string (#3440)

The previous code returned the text representation of the error body type, which resulted in errors appearing in the UI as:

```
okhttp3.ResponseBody$Companion$asResponseBody$1@...
```

This code actually converts the *body* of the error response to a string, so the error is displayed correctly.
This commit is contained in:
Nik Clayton 2023-03-13 09:58:15 +01:00 committed by GitHub
parent 51be2c9374
commit 9ec9d35100
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,7 +58,7 @@ class NotificationsPagingSource @Inject constructor(
} }
if (!response.isSuccessful) { if (!response.isSuccessful) {
return LoadResult.Error(Throwable(response.errorBody().toString())) return LoadResult.Error(Throwable(response.errorBody()?.string()))
} }
val links = getPageLinks(response.headers()["link"]) val links = getPageLinks(response.headers()["link"])