@@ -22,13 +22,6 @@ declare module 'graphql' {
2222 */
2323 readonly coordinate ?: string ;
2424 }
25-
26- interface GraphQLFormattedError {
27- /**
28- * An optional schema coordinate (e.g. "MyType.myField") associated with this error.
29- */
30- readonly coordinate ?: string ;
31- }
3225}
3326
3427const possibleGraphQLErrorProperties = [
@@ -53,13 +46,6 @@ export function isGraphQLErrorLike(error: any) {
5346 ) ;
5447}
5548
56- export const toJSON : GraphQLError [ 'toJSON' ] = function toJSON ( this : GraphQLError ) {
57- const formattedError = GraphQLError . prototype . toJSON . apply ( this ) ;
58- // @ts -expect-error coordinate is readonly
59- formattedError . coordinate = this . coordinate ;
60- return formattedError ;
61- } ;
62-
6349export function createGraphQLError ( message : string , options ?: GraphQLErrorOptions ) : GraphQLError {
6450 if (
6551 options ?. originalError &&
@@ -90,7 +76,6 @@ export function createGraphQLError(message: string, options?: GraphQLErrorOption
9076 if ( options ?. coordinate && error . coordinate == null ) {
9177 Object . defineProperties ( error , {
9278 coordinate : { value : options . coordinate , enumerable : true , configurable : true } ,
93- toJSON : { value : toJSON } ,
9479 } ) ;
9580 }
9681
@@ -116,7 +101,6 @@ export function locatedError(
116101 const coordinate = `${ info . parentType . name } .${ info . fieldName } ` ;
117102 Object . defineProperties ( error , {
118103 coordinate : { value : coordinate , enumerable : true , configurable : true } ,
119- toJSON : { value : toJSON } ,
120104 } ) ;
121105 }
122106
0 commit comments