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, ) 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