Skip to content

Commit

Permalink
fix: graphql masked errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Moumouls committed Jun 14, 2022
1 parent 72fac8a commit e452d50
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/ParseGraphQLServer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10646,6 +10646,12 @@ describe('ParseGraphQLServer', () => {
},
resolve: (p, { message }) => message,
},
errorQuery: {
type: new GraphQLNonNull(GraphQLString),
resolve: () => {
throw new Error('A test error');
},
},
customQueryWithAutoTypeReturn: {
type: SomeClassType,
args: {
Expand Down Expand Up @@ -10734,6 +10740,18 @@ describe('ParseGraphQLServer', () => {
expect(result.data.customQuery).toEqual('hello');
});

it('can forward original error of a custom query', async () => {
await expectAsync(
apolloClient.query({
query: gql`
query ErrorQuery {
errorQuery
}
`,
})
).toBeRejectedWithError('A test error');
});

it('can resolve a custom query with auto type return', async () => {
const obj = new Parse.Object('SomeClass');
await obj.save({ name: 'aname', type: 'robot' });
Expand Down
1 change: 1 addition & 0 deletions src/GraphQL/ParseGraphQLServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class ParseGraphQLServer {
config,
auth,
}),
maskedErrors: false,
multipart: {
fileSize: this._transformMaxUploadSizeToBytes(
this.parseServer.config.maxUploadSize || '20mb'
Expand Down

0 comments on commit e452d50

Please sign in to comment.