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

TransactionError.md

235 lines5.3 KB

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