fix: errors in GraphQL do not show the original error but a general Unexpected Error (#8045)

This commit is contained in:
Antoine Cormouls
2022-06-17 13:40:31 +02:00
committed by GitHub
parent 03caae1e61
commit 0d818879c2
2 changed files with 19 additions and 0 deletions

View File

@@ -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: {
@@ -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' });

View File

@@ -38,6 +38,7 @@ class ParseGraphQLServer {
config,
auth,
}),
maskedErrors: false,
multipart: {
fileSize: this._transformMaxUploadSizeToBytes(
this.parseServer.config.maxUploadSize || '20mb'