Skip to content

Commit

Permalink
move errors to GraphQLWrappedError rather than context
Browse files Browse the repository at this point in the history
- preserves order of errors with respect to operation
- bubbling errors mask the non-bubbling errors such that extra information does not leak
  • Loading branch information
yaacovCR committed Oct 29, 2024
1 parent d59c725 commit 6a913ce
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 155 deletions.
6 changes: 1 addition & 5 deletions src/execution/__tests__/executor-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -680,14 +680,10 @@ describe('Execute: Handles basic execution tasks', () => {

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

// a bubbling error is allowed to mask the non-bubbling error
expectJSON(await result).toDeepEqual({
data: null,
errors: [
{
message: 'Oops',
locations: [{ line: 3, column: 9 }],
path: ['asyncError'],
},
{
message:
'Cannot return null for non-nullable field Query.asyncNonNullError.',
Expand Down
30 changes: 15 additions & 15 deletions src/execution/__tests__/nonnull-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,16 @@ describe('Execute: handles non-nullable types', () => {
path: ['syncNest', 'sync'],
locations: [{ line: 4, column: 11 }],
},
{
message: syncError.message,
path: ['syncNest', 'syncNest', 'sync'],
locations: [{ line: 6, column: 22 }],
},
{
message: promiseError.message,
path: ['syncNest', 'promise'],
locations: [{ line: 5, column: 11 }],
},
{
message: syncError.message,
path: ['syncNest', 'syncNest', 'sync'],
locations: [{ line: 6, column: 22 }],
},
{
message: promiseError.message,
path: ['syncNest', 'syncNest', 'promise'],
Expand All @@ -274,26 +274,26 @@ describe('Execute: handles non-nullable types', () => {
path: ['syncNest', 'promiseNest', 'sync'],
locations: [{ line: 7, column: 25 }],
},
{
message: syncError.message,
path: ['promiseNest', 'sync'],
locations: [{ line: 10, column: 11 }],
},
{
message: syncError.message,
path: ['promiseNest', 'syncNest', 'sync'],
locations: [{ line: 12, column: 22 }],
},
{
message: promiseError.message,
path: ['syncNest', 'promiseNest', 'promise'],
locations: [{ line: 7, column: 30 }],
},
{
message: syncError.message,
path: ['promiseNest', 'sync'],
locations: [{ line: 10, column: 11 }],
},
{
message: promiseError.message,
path: ['promiseNest', 'promise'],
locations: [{ line: 11, column: 11 }],
},
{
message: syncError.message,
path: ['promiseNest', 'syncNest', 'sync'],
locations: [{ line: 12, column: 22 }],
},
{
message: promiseError.message,
path: ['promiseNest', 'syncNest', 'promise'],
Expand Down
Loading

0 comments on commit 6a913ce

Please sign in to comment.