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