You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/error-handling.md
+47Lines changed: 47 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,52 @@ The error includes:
45
45
-`issues`: Array of validation issues with messages and paths
46
46
-`message`: A formatted error message listing all issues
47
47
48
+
## Query Collection Error Tracking
49
+
50
+
Query collections provide enhanced error tracking utilities through the `utils` object. These methods expose error state information and provide recovery mechanisms for failed queries:
-**`lastError()`**: Returns the most recent error encountered by the query, or `undefined` if no errors have occurred:
90
+
-**`isError()`**: Returns a boolean indicating whether the collection is currently in an error state:
91
+
-**`errorCount()`**: Returns the number of consecutive sync failures. This counter is incremented only when queries fail completely (not per retry attempt) and is reset on successful queries:
92
+
-**`clearError()`**: Clears the error state and triggers a refetch of the query. This method resets both `lastError` and `errorCount`:
93
+
48
94
## Collection Status and Error States
49
95
50
96
Collections track their status and transition between states:
@@ -281,6 +327,7 @@ When sync errors occur:
281
327
- Error is logged to console: `[QueryCollection] Error observing query...`
282
328
- Collection is marked as ready to prevent blocking the application
283
329
- Cached data remains available
330
+
- Error tracking counters are updated (`lastError`, `errorCount`)
0 commit comments