Skip to content

Commit 6a913ce

Browse files
committed
move errors to GraphQLWrappedError rather than context
- preserves order of errors with respect to operation - bubbling errors mask the non-bubbling errors such that extra information does not leak
1 parent d59c725 commit 6a913ce

File tree

3 files changed

+120
-155
lines changed

3 files changed

+120
-155
lines changed

src/execution/__tests__/executor-test.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -680,14 +680,10 @@ describe('Execute: Handles basic execution tasks', () => {
680680

681681
const result = execute({ schema, document });
682682

683+
// a bubbling error is allowed to mask the non-bubbling error
683684
expectJSON(await result).toDeepEqual({
684685
data: null,
685686
errors: [
686-
{
687-
message: 'Oops',
688-
locations: [{ line: 3, column: 9 }],
689-
path: ['asyncError'],
690-
},
691687
{
692688
message:
693689
'Cannot return null for non-nullable field Query.asyncNonNullError.',

src/execution/__tests__/nonnull-test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -254,16 +254,16 @@ describe('Execute: handles non-nullable types', () => {
254254
path: ['syncNest', 'sync'],
255255
locations: [{ line: 4, column: 11 }],
256256
},
257-
{
258-
message: syncError.message,
259-
path: ['syncNest', 'syncNest', 'sync'],
260-
locations: [{ line: 6, column: 22 }],
261-
},
262257
{
263258
message: promiseError.message,
264259
path: ['syncNest', 'promise'],
265260
locations: [{ line: 5, column: 11 }],
266261
},
262+
{
263+
message: syncError.message,
264+
path: ['syncNest', 'syncNest', 'sync'],
265+
locations: [{ line: 6, column: 22 }],
266+
},
267267
{
268268
message: promiseError.message,
269269
path: ['syncNest', 'syncNest', 'promise'],
@@ -274,26 +274,26 @@ describe('Execute: handles non-nullable types', () => {
274274
path: ['syncNest', 'promiseNest', 'sync'],
275275
locations: [{ line: 7, column: 25 }],
276276
},
277-
{
278-
message: syncError.message,
279-
path: ['promiseNest', 'sync'],
280-
locations: [{ line: 10, column: 11 }],
281-
},
282-
{
283-
message: syncError.message,
284-
path: ['promiseNest', 'syncNest', 'sync'],
285-
locations: [{ line: 12, column: 22 }],
286-
},
287277
{
288278
message: promiseError.message,
289279
path: ['syncNest', 'promiseNest', 'promise'],
290280
locations: [{ line: 7, column: 30 }],
291281
},
282+
{
283+
message: syncError.message,
284+
path: ['promiseNest', 'sync'],
285+
locations: [{ line: 10, column: 11 }],
286+
},
292287
{
293288
message: promiseError.message,
294289
path: ['promiseNest', 'promise'],
295290
locations: [{ line: 11, column: 11 }],
296291
},
292+
{
293+
message: syncError.message,
294+
path: ['promiseNest', 'syncNest', 'sync'],
295+
locations: [{ line: 12, column: 22 }],
296+
},
297297
{
298298
message: promiseError.message,
299299
path: ['promiseNest', 'syncNest', 'promise'],

0 commit comments

Comments
 (0)