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