From 9ec9d351006718cb567c894ad856e043f07bf27f Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Mon, 13 Mar 2023 09:58:15 +0100 Subject: [PATCH] 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. --- .../tusky/components/notifications/NotificationsPagingSource.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationsPagingSource.kt b/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationsPagingSource.kt index 44db2308..90d24fed 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationsPagingSource.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/notifications/NotificationsPagingSource.kt @@ -58,7 +58,7 @@ class NotificationsPagingSource @Inject constructor( } if (!response.isSuccessful) { - return LoadResult.Error(Throwable(response.errorBody().toString())) + return LoadResult.Error(Throwable(response.errorBody()?.string())) } val links = getPageLinks(response.headers()["link"])