fix: remove circular serialization in GQL errors
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { graphqlHTTP } from 'express-graphql';
|
||||
import logger from '../helpers/logger';
|
||||
import { applyMiddleware } from 'graphql-middleware';
|
||||
import authentication from '../helpers/authentication';
|
||||
import { join } from 'path';
|
||||
import { graphqlHTTP } from 'express-graphql';
|
||||
import { loadSchemaSync } from '@graphql-tools/load';
|
||||
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader';
|
||||
import { addResolversToSchema } from '@graphql-tools/schema';
|
||||
import { applyMiddleware } from 'graphql-middleware';
|
||||
import logger from '../helpers/logger';
|
||||
import authentication from '../helpers/authentication';
|
||||
import resolvers from '../graphql/resolvers';
|
||||
import HttpError from '../errors/http';
|
||||
|
||||
const schema = loadSchemaSync(join(__dirname, '../graphql/schema.graphql'), {
|
||||
loaders: [new GraphQLFileLoader()],
|
||||
@@ -23,6 +24,10 @@ const graphQLInstance = graphqlHTTP({
|
||||
customFormatErrorFn: (error) => {
|
||||
logger.error(error.path + ' : ' + error.message + '\n' + error.stack);
|
||||
|
||||
if (error.originalError instanceof HttpError) {
|
||||
delete (error.originalError as HttpError).response;
|
||||
}
|
||||
|
||||
return error.originalError;
|
||||
},
|
||||
});
|
||||
|
Reference in New Issue
Block a user