Open History to see the last commit
1import { TanStackDBError } from "@tanstack/db"
2
3// Electric DB Collection Errors
4export class ElectricDBCollectionError extends TanStackDBError {
5 constructor(message: string) {
6 super(message)
7 this.name = `ElectricDBCollectionError`
8 }
9}
10
11export class ExpectedNumberInAwaitTxIdError extends ElectricDBCollectionError {
12 constructor(txIdType: string) {
13 super(`Expected number in awaitTxId, received ${txIdType}`)
14 this.name = `ExpectedNumberInAwaitTxIdError`
15 }
16}
17
18export class TimeoutWaitingForTxIdError extends ElectricDBCollectionError {
19 constructor(txId: number) {
20 super(`Timeout waiting for txId: ${txId}`)
21 this.name = `TimeoutWaitingForTxIdError`
22 }
23}
24
25export class ElectricInsertHandlerMustReturnTxIdError extends ElectricDBCollectionError {
26 constructor() {
27 super(
28 `Electric collection onInsert handler must return a txid or array of txids`
29 )
30 this.name = `ElectricInsertHandlerMustReturnTxIdError`
31 }
32}
33
34export class ElectricUpdateHandlerMustReturnTxIdError extends ElectricDBCollectionError {
35 constructor() {
36 super(
37 `Electric collection onUpdate handler must return a txid or array of txids`
38 )
39 this.name = `ElectricUpdateHandlerMustReturnTxIdError`
40 }
41}
42
43export class ElectricDeleteHandlerMustReturnTxIdError extends ElectricDBCollectionError {
44 constructor() {
45 super(
46 `Electric collection onDelete handler must return a txid or array of txids`
47 )
48 this.name = `ElectricDeleteHandlerMustReturnTxIdError`
49 }
50}