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

KeyUpdateNotAllowedError.md

224 lines4.6 KB

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