fix: errors in GraphQL do not show the original error but a general Unexpected Error (#8045)
This commit is contained in:
@@ -10646,6 +10646,12 @@ describe('ParseGraphQLServer', () => {
|
|||||||
},
|
},
|
||||||
resolve: (p, { message }) => message,
|
resolve: (p, { message }) => message,
|
||||||
},
|
},
|
||||||
|
errorQuery: {
|
||||||
|
type: new GraphQLNonNull(GraphQLString),
|
||||||
|
resolve: () => {
|
||||||
|
throw new Error('A test error');
|
||||||
|
},
|
||||||
|
},
|
||||||
customQueryWithAutoTypeReturn: {
|
customQueryWithAutoTypeReturn: {
|
||||||
type: SomeClassType,
|
type: SomeClassType,
|
||||||
args: {
|
args: {
|
||||||
@@ -10734,6 +10740,18 @@ describe('ParseGraphQLServer', () => {
|
|||||||
expect(result.data.customQuery).toEqual('hello');
|
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 () => {
|
it('can resolve a custom query with auto type return', async () => {
|
||||||
const obj = new Parse.Object('SomeClass');
|
const obj = new Parse.Object('SomeClass');
|
||||||
await obj.save({ name: 'aname', type: 'robot' });
|
await obj.save({ name: 'aname', type: 'robot' });
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class ParseGraphQLServer {
|
|||||||
config,
|
config,
|
||||||
auth,
|
auth,
|
||||||
}),
|
}),
|
||||||
|
maskedErrors: false,
|
||||||
multipart: {
|
multipart: {
|
||||||
fileSize: this._transformMaxUploadSizeToBytes(
|
fileSize: this._transformMaxUploadSizeToBytes(
|
||||||
this.parseServer.config.maxUploadSize || '20mb'
|
this.parseServer.config.maxUploadSize || '20mb'
|
||||||
|
|||||||
Reference in New Issue
Block a user