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

SchemaValidationError.md

249 lines4.7 KB

1---
2id: SchemaValidationError
3title: SchemaValidationError
4---
5​
6Defined in: [packages/db/src/errors.ts:20](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L20)
7​
8## Extends
9​
10- [`TanStackDBError`](TanStackDBError.md)
11​
12## Constructors
13​
14### Constructor
15​
16```ts
17new SchemaValidationError(
18 type,
19 issues,
20 message?): SchemaValidationError;
21```
22​
23Defined in: [packages/db/src/errors.ts:27](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L27)
24​
25#### Parameters
26​
27##### type
28​
29`"insert"` | `"update"`
30​
31##### issues
32​
33readonly `object`[]
34​
35##### message?
36​
37`string`
38​
39#### Returns
40​
41`SchemaValidationError`
42​
43#### Overrides
44​
45[`TanStackDBError`](TanStackDBError.md).[`constructor`](TanStackDBError.md#constructor)
46​
47## Properties
48​
49### cause?
50​
51```ts
52optional cause: unknown;
53```
54​
55Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26
56​
57#### Inherited from
58​
59[`TanStackDBError`](TanStackDBError.md).[`cause`](TanStackDBError.md#cause)
60​
61***
62​
63### issues
64​
65```ts
66issues: readonly object[];
67```
68​
69Defined in: [packages/db/src/errors.ts:22](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L22)
70​
71***
72​
73### message
74​
75```ts
76message: string;
77```
78​
79Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077
80​
81#### Inherited from
82​
83[`TanStackDBError`](TanStackDBError.md).[`message`](TanStackDBError.md#message)
84​
85***
86​
87### name
88​
89```ts
90name: string;
91```
92​
93Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076
94​
95#### Inherited from
96​
97[`TanStackDBError`](TanStackDBError.md).[`name`](TanStackDBError.md#name)
98​
99***
100​
101### stack?
102​
103```ts
104optional stack: string;
105```
106​
107Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078
108​
109#### Inherited from
110​
111[`TanStackDBError`](TanStackDBError.md).[`stack`](TanStackDBError.md#stack)
112​
113***
114​
115### type
116​
117```ts
118type: "insert" | "update";
119```
120​
121Defined in: [packages/db/src/errors.ts:21](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L21)
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[`TanStackDBError`](TanStackDBError.md).[`stackTraceLimit`](TanStackDBError.md#stacktracelimit)
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();
181​
182function b() {
183 c();
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;
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[`TanStackDBError`](TanStackDBError.md).[`captureStackTrace`](TanStackDBError.md#capturestacktrace)
218​
219***
220​
221### prepareStackTrace()
222​
223```ts
224static prepareStackTrace(err, stackTraces): any;
225```
226​
227Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:55
228​
229#### Parameters
230​
231##### err
232​
233`Error`
234​
235##### stackTraces
236​
237`CallSite`[]
238​
239#### Returns
240​
241`any`
242​
243#### See
244​
245https://v8.dev/docs/stack-trace-api#customizing-stack-traces
246​
247#### Inherited from
248​
249[`TanStackDBError`](TanStackDBError.md).[`prepareStackTrace`](TanStackDBError.md#preparestacktrace)