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