Reputation: 1424
I am trying to do a custom error format on graphql without using express-graphql. What I tried to do is:
import { graphql } from 'graphql';
graphql.formatError = err => ...;
Sadly, it doesn't work. It would be great if you guys could help me out.
Upvotes: 0
Views: 388
Reputation: 191
Looking in the docs and the source code, I did'nt found anything about formatError in graphql module, only in 'express-graphql':
const express = require('express');
const graphqlHTTP = require('express-graphql');
const app = express();
app.use('/graphql', graphqlHTTP({
schema: MyGraphQLSchema,
graphiql: true,
formatError: (error) => {}
}));
Upvotes: 1