Skip to content

Commit

Permalink
don't use throwIfAborted
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacovCR committed Oct 23, 2024
1 parent f05fc11 commit 465cb59
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/execution/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,10 +517,8 @@ export function validateExecutionArgs(
abortSignal,
} = args;

try {
abortSignal?.throwIfAborted();
} catch (rawError: unknown) {
return [locatedError(rawError, undefined)];
if (abortSignal?.aborted) {
return [locatedError(abortSignal.reason, undefined)];
}

// If the schema used for execution is invalid, throw an error.
Expand Down Expand Up @@ -667,11 +665,11 @@ function executeFieldsSerially(
groupedFieldSet,
(graphqlWrappedResult, [responseName, fieldDetailsList]) => {
const fieldPath = addPath(path, responseName, parentType.name);
try {
exeContext.validatedExecutionArgs.abortSignal?.throwIfAborted();
} catch (rawError) {

const abortSignal = exeContext.validatedExecutionArgs.abortSignal;
if (abortSignal?.aborted) {
handleFieldError(
rawError,
abortSignal.reason,
exeContext,
parentType,
fieldDetailsList,
Expand Down Expand Up @@ -733,11 +731,10 @@ function executeFields(
for (const [responseName, fieldDetailsList] of groupedFieldSet) {
const fieldPath = addPath(path, responseName, parentType.name);

try {
exeContext.validatedExecutionArgs.abortSignal?.throwIfAborted();
} catch (rawError) {
const abortSignal = exeContext.validatedExecutionArgs.abortSignal;
if (abortSignal?.aborted) {
throw locatedError(
rawError,
abortSignal.reason,
toNodes(fieldDetailsList),
pathToArray(fieldPath),
);
Expand Down

0 comments on commit 465cb59

Please sign in to comment.