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

TanStackDBError.md

254 lines4.5 KB

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