Skip to content

Commit a12f7c3

Browse files
committed
Actually the right place to fix this is in completeValueWithLocatedError by mapping any error a failed future to a ‘locatedError’
1 parent 934049f commit a12f7c3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Sources/GraphQL/Execution/Execute.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,10 @@ func completeValueCatchingError(
788788
path: path,
789789
result: result
790790
).mapIfError { error -> Any? in
791-
exeContext.append(error: locatedError(originalError: error, nodes: fieldASTs, path: path))
791+
guard let error = error as? GraphQLError else {
792+
fatalError()
793+
}
794+
exeContext.append(error: error)
792795
return nil
793796
}
794797

@@ -821,8 +824,9 @@ func completeValueWithLocatedError(
821824
info: info,
822825
path: path,
823826
result: result
824-
)
825-
827+
).thenIfErrorThrowing { error -> Any? in
828+
throw locatedError(originalError: error, nodes: fieldASTs, path: path)
829+
}
826830
return completed
827831
} catch {
828832
throw locatedError(

0 commit comments

Comments
 (0)