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

TransactionError.md

238 lines5.5 KB

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