Open History to see the last commit
1---
2id: SchemaValidationError
3title: SchemaValidationError
4---
5
6# Class: SchemaValidationError
7
8Defined in: [packages/db/src/errors.ts:18](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L18)
9
10## Extends
11
12- [`TanStackDBError`](TanStackDBError.md)
13
14## Constructors
15
16### Constructor
17
18```ts
19new SchemaValidationError(
20 type,
21 issues,
22 message?): SchemaValidationError;
23```
24
25Defined in: [packages/db/src/errors.ts:25](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L25)
26
27#### Parameters
28
29##### type
30
31`"insert"` | `"update"`
32
33##### issues
34
35readonly `object`[]
36
37##### message?
38
39`string`
40
41#### Returns
42
43`SchemaValidationError`
44
45#### Overrides
46
47[`TanStackDBError`](TanStackDBError.md).[`constructor`](TanStackDBError.md#constructor)
48
49## Properties
50
51### cause?
52
53```ts
54optional cause: unknown;
55```
56
57Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26
58
59#### Inherited from
60
61[`TanStackDBError`](TanStackDBError.md).[`cause`](TanStackDBError.md#cause)
62
63***
64
65### issues
66
67```ts
68issues: readonly object[];
69```
70
71Defined in: [packages/db/src/errors.ts:20](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L20)
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[`TanStackDBError`](TanStackDBError.md).[`message`](TanStackDBError.md#message)
86
87***
88
89### name
90
91```ts
92name: string;
93```
94
95Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076
96
97#### Inherited from
98
99[`TanStackDBError`](TanStackDBError.md).[`name`](TanStackDBError.md#name)
100
101***
102
103### stack?
104
105```ts
106optional stack: string;
107```
108
109Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078
110
111#### Inherited from
112
113[`TanStackDBError`](TanStackDBError.md).[`stack`](TanStackDBError.md#stack)
114
115***
116
117### type
118
119```ts
120type: "insert" | "update";
121```
122
123Defined in: [packages/db/src/errors.ts:19](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L19)
124
125***
126
127### stackTraceLimit
128
129```ts
130static stackTraceLimit: number;
131```
132
133Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:67
134
135The `Error.stackTraceLimit` property specifies the number of stack frames
136collected by a stack trace (whether generated by `new Error().stack` or
137`Error.captureStackTrace(obj)`).
138
139The default value is `10` but may be set to any valid JavaScript number. Changes
140will affect any stack trace captured _after_ the value has been changed.
141
142If set to a non-number value, or set to a negative number, stack traces will
143not capture any frames.
144
145#### Inherited from
146
147[`TanStackDBError`](TanStackDBError.md).[`stackTraceLimit`](TanStackDBError.md#stacktracelimit)
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[`TanStackDBError`](TanStackDBError.md).[`captureStackTrace`](TanStackDBError.md#capturestacktrace)
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[`TanStackDBError`](TanStackDBError.md).[`prepareStackTrace`](TanStackDBError.md#preparestacktrace)