mirror of
https://github.com/tcgdex/cards-database.git
synced 2025-04-22 19:02:10 +00:00
refactor: Add more logging forGraphQL errors (#218)
This commit is contained in:
parent
9956808686
commit
16467d4a19
@ -1,6 +1,6 @@
|
||||
import express from 'express'
|
||||
import { graphqlHTTP } from 'express-graphql'
|
||||
import { buildSchema } from 'graphql'
|
||||
import { buildSchema, formatError } from 'graphql'
|
||||
import resolver from './resolver'
|
||||
import fs from 'fs'
|
||||
|
||||
@ -16,7 +16,11 @@ const schema = buildSchema(fs.readFileSync('./public/v2/graphql.gql').toString()
|
||||
router.use(graphqlHTTP({
|
||||
schema,
|
||||
rootValue: resolver,
|
||||
graphiql: true
|
||||
graphiql: true,
|
||||
customFormatErrorFn(error) {
|
||||
console.error(error)
|
||||
return formatError(error)
|
||||
}
|
||||
}))
|
||||
|
||||
export default router
|
||||
|
Loading…
x
Reference in New Issue
Block a user