Skip to content

Fix serialization exception occurring when PostgrestRestException#details is not a String #956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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,
)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
): RestException(message, """
|Hint: $hint
|Details: $details
""".trimIndent(), response)
Loading