@@ -86,23 +86,6 @@ export function GraphQLError( // eslint-disable-line no-redeclare
86
86
path ?: ?Array < string | number > ,
87
87
originalError ?: ?Error
88
88
) {
89
- // Include (non-enumerable) stack trace.
90
- if ( originalError && originalError . stack ) {
91
- Object . defineProperty ( this , 'stack' , {
92
- value : originalError . stack ,
93
- writable : true ,
94
- configurable : true
95
- } ) ;
96
- } else if ( Error . captureStackTrace ) {
97
- Error . captureStackTrace ( this , GraphQLError ) ;
98
- } else {
99
- Object. defineProperty ( this , 'stack' , {
100
- value : Error ( ) . stack ,
101
- writable : true ,
102
- configurable : true
103
- } ) ;
104
- }
105
-
106
89
// Compute locations in the source for the given nodes/positions.
107
90
let _source = source ;
108
91
if ( ! _source && nodes && nodes . length > 0 ) {
@@ -165,6 +148,23 @@ export function GraphQLError( // eslint-disable-line no-redeclare
165
148
value : originalError
166
149
}
167
150
} ) ;
151
+
152
+ // Include (non-enumerable) stack trace.
153
+ if ( originalError && originalError . stack ) {
154
+ Object . defineProperty ( this , 'stack' , {
155
+ value : originalError . stack ,
156
+ writable : true ,
157
+ configurable : true
158
+ } ) ;
159
+ } else if ( Error . captureStackTrace ) {
160
+ Error . captureStackTrace ( this , GraphQLError ) ;
161
+ } else {
162
+ Object . defineProperty ( this , 'stack' , {
163
+ value : Error ( ) . stack ,
164
+ writable : true ,
165
+ configurable : true
166
+ } ) ;
167
+ }
168
168
}
169
169
170
170
( GraphQLError : any ) . prototype = Object . create ( Error . prototype , {
0 commit comments