mirror of
https://github.com/tcgdex/cards-database.git
synced 2025-04-23 03:12: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 express from 'express'
|
||||||
import { graphqlHTTP } from 'express-graphql'
|
import { graphqlHTTP } from 'express-graphql'
|
||||||
import { buildSchema } from 'graphql'
|
import { buildSchema, formatError } from 'graphql'
|
||||||
import resolver from './resolver'
|
import resolver from './resolver'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
|
|
||||||
@ -16,7 +16,11 @@ const schema = buildSchema(fs.readFileSync('./public/v2/graphql.gql').toString()
|
|||||||
router.use(graphqlHTTP({
|
router.use(graphqlHTTP({
|
||||||
schema,
|
schema,
|
||||||
rootValue: resolver,
|
rootValue: resolver,
|
||||||
graphiql: true
|
graphiql: true,
|
||||||
|
customFormatErrorFn(error) {
|
||||||
|
console.error(error)
|
||||||
|
return formatError(error)
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
export default router
|
export default router
|
||||||
|
Loading…
x
Reference in New Issue
Block a user