From 7e79c115dc100bb734040a180f675367a01f5a81 Mon Sep 17 00:00:00 2001 From: Dominic Gunther Bauer <46312751+DominicGBauer@users.noreply.github.com> Date: Mon, 23 Dec 2024 20:30:27 +0200 Subject: [PATCH] chore: add documentation for fatal error (#93) --- .../com/powersync/connector/supabase/SupabaseConnector.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/connectors/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt b/connectors/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt index 0e512c9..1ada35e 100644 --- a/connectors/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt +++ b/connectors/supabase/src/commonMain/kotlin/com/powersync/connector/supabase/SupabaseConnector.kt @@ -185,6 +185,14 @@ public class SupabaseConnector( transaction.complete(null) } catch (e: Exception) { if (errorCode != null && PostgresFatalCodes.isFatalError(errorCode.toString())) { + /** + * Instead of blocking the queue with these errors, + * discard the (rest of the) transaction. + * + * Note that these errors typically indicate a bug in the application. + * If protecting against data loss is important, save the failing records + * elsewhere instead of discarding, and/or notify the user. + */ Logger.e("Data upload error: ${e.message}") Logger.e("Discarding entry: $lastEntry") transaction.complete(null)