File tree 3 files changed +20
-2
lines changed
3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,19 @@ import { ASTNode } from '../language/ast';
4
4
import { Source } from '../language/source' ;
5
5
import { SourceLocation } from '../language/location' ;
6
6
7
+ /**
8
+ * Custom extensions
9
+ *
10
+ * @remarks
11
+ * Use a unique identifier name for your extension, for example the name of
12
+ * your library or project. Do not use a shortened identifier as this increases
13
+ * the risk of conflicts. We recommend you add at most one extension field,
14
+ * an object which can contain all the values you need.
15
+ */
16
+ export interface GraphQLErrorExtensions {
17
+ [ attributeName : string ] : any ;
18
+ }
19
+
7
20
/**
8
21
* A GraphQLError describes an Error found during the parse, validate, or
9
22
* execute phases of performing a GraphQL operation. In addition to a message
@@ -18,7 +31,7 @@ export class GraphQLError extends Error {
18
31
positions ?: Maybe < ReadonlyArray < number > > ,
19
32
path ?: Maybe < ReadonlyArray < string | number > > ,
20
33
originalError ?: Maybe < Error > ,
21
- extensions ?: Maybe < { [ key : string ] : any } > ,
34
+ extensions ?: Maybe < { [ key : string ] : GraphQLErrorExtensions } > ,
22
35
) ;
23
36
24
37
/**
Original file line number Diff line number Diff line change 1
- export { GraphQLError , printError } from './GraphQLError' ;
1
+ export {
2
+ GraphQLError ,
3
+ GraphQLErrorExtensions ,
4
+ printError ,
5
+ } from './GraphQLError' ;
2
6
export { syntaxError } from './syntaxError' ;
3
7
export { locatedError } from './locatedError' ;
4
8
export { formatError , GraphQLFormattedError } from './formatError' ;
Original file line number Diff line number Diff line change @@ -364,6 +364,7 @@ export {
364
364
printError ,
365
365
formatError ,
366
366
GraphQLFormattedError ,
367
+ GraphQLErrorExtensions ,
367
368
} from './error/index' ;
368
369
369
370
// Utilities for operating on GraphQL type schema and parsed sources.
You can’t perform that action at this time.
0 commit comments