File tree 2 files changed +11
-5
lines changed
2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export class GraphQLError extends Error {
20
20
source : Source ;
21
21
positions : Array < number > ;
22
22
locations : any ;
23
+ originalError : ?Error ;
23
24
24
25
constructor (
25
26
message : string ,
Original file line number Diff line number Diff line change @@ -16,10 +16,15 @@ import { GraphQLError } from './GraphQLError';
16
16
* GraphQL operation, produce a new GraphQLError aware of the location in the
17
17
* document responsible for the original Error.
18
18
*/
19
- export function locatedError ( error : ?Error , nodes : Array < any > ) : GraphQLError {
20
- var message = error ?
21
- error . message || String ( error ) :
19
+ export function locatedError (
20
+ originalError : ?Error ,
21
+ nodes : Array < any >
22
+ ) : GraphQLError {
23
+ const message = originalError ?
24
+ originalError . message || String ( originalError ) :
22
25
'An unknown error occurred.' ;
23
- var stack = error ? error . stack : null ;
24
- return new GraphQLError ( message , nodes , stack ) ;
26
+ const stack = originalError ? originalError . stack : null ;
27
+ const error = new GraphQLError ( message , nodes , stack ) ;
28
+ error . originalError = originalError ;
29
+ return error ;
25
30
}
You can’t perform that action at this time.
0 commit comments