Skip to content

Commit 2f5a2e0

Browse files
chore: add documentation for fatal error (#11)
1 parent dc1a76f commit 2f5a2e0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Demo/PowerSyncExample/PowerSync/SupabaseConnector.swift

+6
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ class SupabaseConnector: PowerSyncBackendConnector {
112112
} catch {
113113
if let errorCode = PostgresFatalCodes.extractErrorCode(from: error),
114114
PostgresFatalCodes.isFatalError(errorCode) {
115+
/// Instead of blocking the queue with these errors,
116+
/// discard the (rest of the) transaction.
117+
///
118+
/// Note that these errors typically indicate a bug in the application.
119+
/// If protecting against data loss is important, save the failing records
120+
/// elsewhere instead of discarding, and/or notify the user.
115121
print("Data upload error: \(error)")
116122
print("Discarding entry: \(lastEntry!)")
117123
_ = try await transaction.complete.invoke(p1: nil)

0 commit comments

Comments
 (0)