Skip to content

Commit c5bd447

Browse files
committed
use define property and guard against existing coordinate
1 parent 9f5dd54 commit c5bd447

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/utils/src/errors.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,12 @@ export function locatedError(
114114
const error = _locatedError(rawError, nodes, path) as GraphQLError;
115115

116116
// `graphql` locatedError is only changing path and nodes if it is not already defined
117-
if (!error.coordinate && info) {
118-
// @ts-expect-error coordinate is readonly, but we don't want to recreate it just to add coordinate
119-
error.coordinate = `${info.parentType.name}.${info.fieldName}`;
117+
if (!error.coordinate && info && error.coordinate == null) {
118+
Object.defineProperty(error, 'coordinate', {
119+
value: `${info.parentType.name}.${info.fieldName}`,
120+
enumerable: true,
121+
configurable: true,
122+
});
120123
}
121124

122125
return error;

0 commit comments

Comments
 (0)