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