File tree Expand file tree Collapse file tree
Supabase/src/commonMain/kotlin/io/github/jan/supabase Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ interface SupabaseClient {
7171 var DEFAULT_LOG_LEVEL = LogLevel .INFO
7272 internal set
7373
74- internal val LOGGER = createLogger(" Supabase-Core" )
74+ val LOGGER = createLogger(" Supabase-Core" )
7575
7676 /* *
7777 * Creates a new [SupabaseLogger] using the [KermitSupabaseLogger] implementation.
Original file line number Diff line number Diff line change @@ -2,11 +2,13 @@ package io.github.jan.supabase
22
33import io.github.jan.supabase.annotations.SupabaseInternal
44import io.github.jan.supabase.exceptions.SupabaseEncodingException
5+ import io.github.jan.supabase.logging.i
56import io.ktor.client.statement.HttpResponse
67import io.ktor.client.statement.bodyAsText
78import io.ktor.http.URLBuilder
89import kotlinx.serialization.ExperimentalSerializationApi
910import kotlinx.serialization.MissingFieldException
11+ import kotlinx.serialization.SerializationException
1012import kotlinx.serialization.json.Json
1113import kotlinx.serialization.json.JsonObject
1214import kotlinx.serialization.json.JsonObjectBuilder
@@ -58,10 +60,11 @@ inline fun <reified T> JsonObject.decodeIfNotEmptyOrDefault(default: T): T {
5860
5961@SupabaseInternal
6062suspend inline fun <reified T > HttpResponse.bodyOrNull (): T ? {
63+ val text = bodyAsText()
6164 return try {
62- val text = bodyAsText()
6365 supabaseJson.decodeFromString<T >(text)
64- } catch (_: Exception ) {
66+ } catch (e: SerializationException ) {
67+ SupabaseClient .LOGGER .i(e) { " Could not decode $text as ${T ::class } ." }
6568 null
6669 }
6770}
You can’t perform that action at this time.
0 commit comments