From 5a76f9f984924015a2775aa724c3fd8d4579601b Mon Sep 17 00:00:00 2001 From: Jan Tennert Date: Sat, 7 Jun 2025 19:52:14 +0200 Subject: [PATCH 1/2] Fix serialization exception occurring when `PostgrestRestException#details` is not a String --- .../postgrest/exception/PostgrestRestException.kt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/exception/PostgrestRestException.kt b/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/exception/PostgrestRestException.kt index 3212ee3fb..a6634e9be 100644 --- a/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/exception/PostgrestRestException.kt +++ b/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/exception/PostgrestRestException.kt @@ -2,6 +2,7 @@ package io.github.jan.supabase.postgrest.exception import io.github.jan.supabase.exceptions.RestException import io.ktor.client.statement.HttpResponse +import kotlinx.serialization.json.JsonElement /** * Exception thrown when a Postgrest request fails @@ -14,7 +15,10 @@ import io.ktor.client.statement.HttpResponse class PostgrestRestException( message: String, val hint: String?, - val details: String?, + val details: JsonElement?, val code: String?, response: HttpResponse -): RestException(message, hint ?: details, response) \ No newline at end of file +): RestException(message, """ + |Hint: $hint + |Details: $details +""".trimIndent(), response) \ No newline at end of file From f54125f7e0ab2a8211a65e1b653619f56460640e Mon Sep 17 00:00:00 2001 From: Jan Tennert Date: Thu, 12 Jun 2025 12:39:41 +0200 Subject: [PATCH 2/2] fix error --- .../io/github/jan/supabase/postgrest/PostgrestErrorResponse.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/PostgrestErrorResponse.kt b/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/PostgrestErrorResponse.kt index 1cb4ed6bc..966b4f4d3 100644 --- a/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/PostgrestErrorResponse.kt +++ b/Postgrest/src/commonMain/kotlin/io/github/jan/supabase/postgrest/PostgrestErrorResponse.kt @@ -1,11 +1,12 @@ package io.github.jan.supabase.postgrest import kotlinx.serialization.Serializable +import kotlinx.serialization.json.JsonElement @Serializable internal data class PostgrestErrorResponse( val message: String, val hint: String? = null, - val details: String? = null, + val details: JsonElement? = null, val code: String? = null, )