Skip to content

Commit

Permalink
fix: proper stack trace for findBy* and findAllBy* queries (#1394)
Browse files Browse the repository at this point in the history
* fix: fix stacktrace for findBy* queries
* chore: cleanup
  • Loading branch information
mdjastrzebski committed Apr 27, 2023
1 parent f7c8400 commit 1764963
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/queries/makeQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ export function makeQueries<Predicate, Options>(
...waitForOptions
}: WaitForOptions = {}
) {
const stackTraceError = new ErrorWithStack(
'STACK_TRACE_ERROR',
findAllFn
);
const deprecatedWaitForOptions =
extractDeprecatedWaitForOptions(queryOptions);

Expand All @@ -204,6 +208,7 @@ export function makeQueries<Predicate, Options>(
{
...deprecatedWaitForOptions,
...waitForOptions,
stackTraceError,
onTimeout,
}
);
Expand All @@ -219,6 +224,7 @@ export function makeQueries<Predicate, Options>(
...waitForOptions
}: WaitForOptions = {}
) {
const stackTraceError = new ErrorWithStack('STACK_TRACE_ERROR', findFn);
const deprecatedWaitForOptions =
extractDeprecatedWaitForOptions(queryOptions);

Expand All @@ -231,6 +237,7 @@ export function makeQueries<Predicate, Options>(
{
...deprecatedWaitForOptions,
...waitForOptions,
stackTraceError,
onTimeout,
}
);
Expand Down

0 comments on commit 1764963

Please sign in to comment.