Skip to content

Instantly share code, notes, and snippets.

@zapkub
Created October 24, 2017 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zapkub/fbb4cf4ce4bc7947a6e2a532679325f2 to your computer and use it in GitHub Desktop.
Save zapkub/fbb4cf4ce4bc7947a6e2a532679325f2 to your computer and use it in GitHub Desktop.
graphqlExpress(req => {
const extendContext = require('./graphql').getGraphQLExtendedContext(req)
// }
return ({
schema,
tracing,
context: {
...req,
...extendContext
},
formatError: ({ originalError, message, stack }) => {
if (originalError && !(originalError instanceof GenericError)) {
console.error('GraphQL track:', originalError)
}
return {
message: message,
code: originalError ? originalError.code : null,
stack: dev ? stack.split('\n') : null
}
}
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment