Skip to content

Commit 1764963

Browse files
fix: proper stack trace for findBy* and findAllBy* queries (#1394)
* fix: fix stacktrace for findBy* queries * chore: cleanup
1 parent f7c8400 commit 1764963

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: src/queries/makeQueries.ts

+7
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ export function makeQueries<Predicate, Options>(
192192
...waitForOptions
193193
}: WaitForOptions = {}
194194
) {
195+
const stackTraceError = new ErrorWithStack(
196+
'STACK_TRACE_ERROR',
197+
findAllFn
198+
);
195199
const deprecatedWaitForOptions =
196200
extractDeprecatedWaitForOptions(queryOptions);
197201

@@ -204,6 +208,7 @@ export function makeQueries<Predicate, Options>(
204208
{
205209
...deprecatedWaitForOptions,
206210
...waitForOptions,
211+
stackTraceError,
207212
onTimeout,
208213
}
209214
);
@@ -219,6 +224,7 @@ export function makeQueries<Predicate, Options>(
219224
...waitForOptions
220225
}: WaitForOptions = {}
221226
) {
227+
const stackTraceError = new ErrorWithStack('STACK_TRACE_ERROR', findFn);
222228
const deprecatedWaitForOptions =
223229
extractDeprecatedWaitForOptions(queryOptions);
224230

@@ -231,6 +237,7 @@ export function makeQueries<Predicate, Options>(
231237
{
232238
...deprecatedWaitForOptions,
233239
...waitForOptions,
240+
stackTraceError,
234241
onTimeout,
235242
}
236243
);

0 commit comments

Comments
 (0)