Open History to see the last commit
1---
2id: TanStackDBError
3title: TanStackDBError
4---
5
6Defined in: [packages/db/src/errors.ts:4](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L4)
7
8## Extends
9
10- `Error`
11
12## Extended by
13
14- [`NonRetriableError`](NonRetriableError.md)
15- [`SchemaValidationError`](SchemaValidationError.md)
16- [`DuplicateDbInstanceError`](DuplicateDbInstanceError.md)
17- [`CollectionConfigurationError`](CollectionConfigurationError.md)
18- [`CollectionStateError`](CollectionStateError.md)
19- [`CollectionOperationError`](CollectionOperationError.md)
20- [`MissingHandlerError`](MissingHandlerError.md)
21- [`TransactionError`](TransactionError.md)
22- [`QueryBuilderError`](QueryBuilderError.md)
23- [`QueryCompilationError`](QueryCompilationError.md)
24- [`JoinError`](JoinError.md)
25- [`GroupByError`](GroupByError.md)
26- [`StorageError`](StorageError.md)
27- [`SyncCleanupError`](SyncCleanupError.md)
28- [`QueryOptimizerError`](QueryOptimizerError.md)
29- [`SetWindowReentrancyError`](SetWindowReentrancyError.md)
30- [`SourceCollectionIdReuseError`](SourceCollectionIdReuseError.md)
31- [`InvalidPoolOptionError`](InvalidPoolOptionError.md)
32
33## Constructors
34
35### Constructor
36
37```ts
38new TanStackDBError(message): TanStackDBError;
39```
40
41Defined in: [packages/db/src/errors.ts:5](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L5)
42
43#### Parameters
44
45##### message
46
47`string`
48
49#### Returns
50
51`TanStackDBError`
52
53#### Overrides
54
55```ts
56Error.constructor
57```
58
59## Properties
60
61### cause?
62
63```ts
64optional cause: unknown;
65```
66
67Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26
68
69#### Inherited from
70
71```ts
72Error.cause
73```
74
75***
76
77### message
78
79```ts
80message: string;
81```
82
83Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077
84
85#### Inherited from
86
87```ts
88Error.message
89```
90
91***
92
93### name
94
95```ts
96name: string;
97```
98
99Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076
100
101#### Inherited from
102
103```ts
104Error.name
105```
106
107***
108
109### stack?
110
111```ts
112optional stack: string;
113```
114
115Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078
116
117#### Inherited from
118
119```ts
120Error.stack
121```
122
123***
124
125### stackTraceLimit
126
127```ts
128static stackTraceLimit: number;
129```
130
131Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:67
132
133The `Error.stackTraceLimit` property specifies the number of stack frames
134collected by a stack trace (whether generated by `new Error().stack` or
135`Error.captureStackTrace(obj)`).
136
137The default value is `10` but may be set to any valid JavaScript number. Changes
138will affect any stack trace captured _after_ the value has been changed.
139
140If set to a non-number value, or set to a negative number, stack traces will
141not capture any frames.
142
143#### Inherited from
144
145```ts
146Error.stackTraceLimit
147```
148
149## Methods
150
151### captureStackTrace()
152
153```ts
154static captureStackTrace(targetObject, constructorOpt?): void;
155```
156
157Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:51
158
159Creates a `.stack` property on `targetObject`, which when accessed returns
160a string representing the location in the code at which
161`Error.captureStackTrace()` was called.
162
163```js
164const myObject = {};
165Error.captureStackTrace(myObject);
166myObject.stack; // Similar to `new Error().stack`
167```
168
169The first line of the trace will be prefixed with
170`${myObject.name}: ${myObject.message}`.
171
172The optional `constructorOpt` argument accepts a function. If given, all frames
173above `constructorOpt`, including `constructorOpt`, will be omitted from the
174generated stack trace.
175
176The `constructorOpt` argument is useful for hiding implementation
177details of error generation from the user. For instance:
178
179```js
180function a() {
181 b();
182}
183
184function b() {
185 c();
186}
187
188function c() {
189 // Create an error without stack trace to avoid calculating the stack trace twice.
190 const { stackTraceLimit } = Error;
191 Error.stackTraceLimit = 0;
192 const error = new Error();
193 Error.stackTraceLimit = stackTraceLimit;
194
195 // Capture the stack trace above function b
196 Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
197 throw error;
198}
199
200a();
201```
202
203#### Parameters
204
205##### targetObject
206
207`object`
208
209##### constructorOpt?
210
211`Function`
212
213#### Returns
214
215`void`
216
217#### Inherited from
218
219```ts
220Error.captureStackTrace
221```
222
223***
224
225### prepareStackTrace()
226
227```ts
228static prepareStackTrace(err, stackTraces): any;
229```
230
231Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:55
232
233#### Parameters
234
235##### err
236
237`Error`
238
239##### stackTraces
240
241`CallSite`[]
242
243#### Returns
244
245`any`
246
247#### See
248
249https://v8.dev/docs/stack-trace-api#customizing-stack-traces
250
251#### Inherited from
252
253```ts
254Error.prepareStackTrace
255```