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

SyncTransactionAbortedError.md

232 lines3.9 KB

1---
2id: SyncTransactionAbortedError
3title: SyncTransactionAbortedError
4---
5​
6# Class: SyncTransactionAbortedError
7​
8Defined in: [packages/db/src/errors.ts:733](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L733)
9​
10A sync transaction was canceled before its writes became visible.
11​
12## Extends
13​
14- `Error`
15​
16## Constructors
17​
18### Constructor
19​
20```ts
21new SyncTransactionAbortedError(): SyncTransactionAbortedError;
22```
23​
24Defined in: [packages/db/src/errors.ts:734](https://github.com/TanStack/db/blob/main/packages/db/src/errors.ts#L734)
25​
26#### Returns
27​
28`SyncTransactionAbortedError`
29​
30#### Overrides
31​
32```ts
33Error.constructor
34```
35​
36## Properties
37​
38### cause?
39​
40```ts
41optional cause: unknown;
42```
43​
44Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:26
45​
46#### Inherited from
47​
48```ts
49Error.cause
50```
51​
52***
53​
54### message
55​
56```ts
57message: string;
58```
59​
60Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1077
61​
62#### Inherited from
63​
64```ts
65Error.message
66```
67​
68***
69​
70### name
71​
72```ts
73name: string;
74```
75​
76Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1076
77​
78#### Inherited from
79​
80```ts
81Error.name
82```
83​
84***
85​
86### stack?
87​
88```ts
89optional stack: string;
90```
91​
92Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/lib.es5.d.ts:1078
93​
94#### Inherited from
95​
96```ts
97Error.stack
98```
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```ts
123Error.stackTraceLimit
124```
125​
126## Methods
127​
128### captureStackTrace()
129​
130```ts
131static captureStackTrace(targetObject, constructorOpt?): void;
132```
133​
134Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:51
135​
136Creates a `.stack` property on `targetObject`, which when accessed returns
137a string representing the location in the code at which
138`Error.captureStackTrace()` was called.
139​
140```js
141const myObject = {};
142Error.captureStackTrace(myObject);
143myObject.stack; // Similar to `new Error().stack`
144```
145​
146The first line of the trace will be prefixed with
147`${myObject.name}: ${myObject.message}`.
148​
149The optional `constructorOpt` argument accepts a function. If given, all frames
150above `constructorOpt`, including `constructorOpt`, will be omitted from the
151generated stack trace.
152​
153The `constructorOpt` argument is useful for hiding implementation
154details of error generation from the user. For instance:
155​
156```js
157function a() {
158 b();
160​
161function b() {
162 c();
164​
165function c() {
166 // Create an error without stack trace to avoid calculating the stack trace twice.
167 const { stackTraceLimit } = Error;
168 Error.stackTraceLimit = 0;
169 const error = new Error();
170 Error.stackTraceLimit = stackTraceLimit;
171​
172 // Capture the stack trace above function b
173 Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
174 throw error;
176​
177a();
178```
179​
180#### Parameters
181​
182##### targetObject
183​
184`object`
185​
186##### constructorOpt?
187​
188`Function`
189​
190#### Returns
191​
192`void`
193​
194#### Inherited from
195​
196```ts
197Error.captureStackTrace
198```
199​
200***
201​
202### prepareStackTrace()
203​
204```ts
205static prepareStackTrace(err, stackTraces): any;
206```
207​
208Defined in: node\_modules/.pnpm/@types+node@25.2.2/node\_modules/@types/node/globals.d.ts:55
209​
210#### Parameters
211​
212##### err
213​
214`Error`
215​
216##### stackTraces
217​
218`CallSite`[]
219​
220#### Returns
221​
222`any`
223​
224#### See
225​
226https://v8.dev/docs/stack-trace-api#customizing-stack-traces
227​
228#### Inherited from
229​
230```ts
231Error.prepareStackTrace
232```