MCPcopy Create free account
hub / github.com/TanStack/db / simulateFailure

Function simulateFailure

examples/react/offline-transactions/src/utils/todos.ts:82–86  ·  view source on GitHub ↗
(probability = 0.2)

Source from the content-addressed store, hash-verified

80
81 // For demo purposes - simulate random failures
82 simulateFailure(probability = 0.2): void {
83 if (Math.random() < probability) {
84 throw new Error(`Simulated network failure`)
85 }
86 },
87}
88
89// Add some initial data for demo

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected