Skip to content
Source
Sign inSign up
TanStack/db

test(conformance): parametrize how adapters surface query errors #1639

Mergedkevin-dp(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/1639/headmerged by kevin-dp(GitHub profile, opens in a new tab)

Showing 3 changed files with 22 additions and 9 deletions.

x
0 of 3 viewed, 3 left
7 additions and 0 deletionspackages/db/tests/conformance/contract.tsModified
View file
@@ -145,5 +145,12 @@
mountDisabled: () => LiveQueryHandle
/** Scenario keys this adapter is empirically known NOT to satisfy yet. */
knownGaps?: ReadonlyArray<string>
+ /**
+ * How the adapter surfaces a query error (see the `error-status` scenario):
+ * - `flag` (default): a readable `isError`/`status === 'error'` on the result.
+ * - `throw`: reading the errored result throws, for a framework error boundary
+ * to catch (e.g. Solid's `createResource`/`<ErrorBoundary>` model).
+ */
+ errorSurface?: `flag` | `throw`
features?: { serverSnapshot?: boolean; suspense?: boolean }
9 additions and 3 deletionspackages/db/tests/conformance/suite.tsModified
View file
@@ -636,14 +636,20 @@
​
scenario(
`error-status`,
- `a failing source surfaces status=error / isError`,
+ `a failing source surfaces an error (flag or boundary)`,
async () => {
const source = driver.makeErrorSource()
const h = driver.mountCollection(source.collection)