Commit 1b5c78ae authored by Jure's avatar Jure

fix(server): log errors correctly if originalError empty

parent 2a9c4c47
Pipeline #13110 passed with stages
in 13 minutes and 1 second
......@@ -41,10 +41,7 @@ const api = app => {
pubsweetError => error instanceof pubsweetError,
)
// err is always a GraphQLError which should be passed to the client
if (
Object.keys(err.originalError).length !== 0 &&
!isPubsweetDefinedError
)
if (!isEmpty(err.originalError) && !isPubsweetDefinedError)
return {
name: 'Server Error',
message: 'Something went wrong! Please contact your administrator',
......
......@@ -33,7 +33,7 @@ describe('GraphQL errors', () => {
expect(body.errors).toHaveLength(1)
expect(body.errors).toContainEqual({
message: 'Cannot query field "invalidProperty" on type "User".',
name: 'GraphQLError',
name: 'ValidationError',
extensions: {
code: 'GRAPHQL_VALIDATION_FAILED',
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment