Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

errors.ts

37 lines1.2 KB

1import { TanStackDBError } from '@tanstack/db'
2​
3// Electric DB Collection Errors
4export class ElectricDBCollectionError extends TanStackDBError {
5 constructor(message: string, collectionId?: string) {
6 super(`${collectionId ? `[${collectionId}] ` : ``}${message}`)
7 this.name = `ElectricDBCollectionError`
8 }
9}
10​
11export class ExpectedNumberInAwaitTxIdError extends ElectricDBCollectionError {
12 constructor(txIdType: string, collectionId?: string) {
13 super(`Expected number in awaitTxId, received ${txIdType}`, collectionId)
14 this.name = `ExpectedNumberInAwaitTxIdError`
15 }
17​
18export class TimeoutWaitingForTxIdError extends ElectricDBCollectionError {
19 constructor(txId: number, collectionId?: string) {
20 super(`Timeout waiting for txId: ${txId}`, collectionId)
21 this.name = `TimeoutWaitingForTxIdError`
22 }
24​
25export class TimeoutWaitingForMatchError extends ElectricDBCollectionError {
26 constructor(collectionId?: string) {
27 super(`Timeout waiting for custom match function`, collectionId)
28 this.name = `TimeoutWaitingForMatchError`
29 }
31​
32export class StreamAbortedError extends ElectricDBCollectionError {
33 constructor(collectionId?: string) {
34 super(`Stream aborted`, collectionId)
35 this.name = `StreamAbortedError`
36 }