comments out breaking graphql errors

This commit is contained in:
James
2020-09-14 21:04:02 -04:00
parent f5731f2fc8
commit 4e3cc2bc05

View File

@@ -71,30 +71,30 @@ class GraphQL {
mutation,
});
this.errorExtensions = [];
this.errorExtensionIteration = 0;
// this.errorExtensions = [];
// this.errorExtensionIteration = 0;
this.extensions = async (info) => {
const { result } = info;
if (result.errors) {
const afterErrorHook = typeof this.config.hooks.afterError === 'function' ? this.config.hooks.afterError : null;
this.errorExtensions = await errorHandler(info, this.config.debug, afterErrorHook);
}
return null;
};
// this.extensions = async (info) => {
// const { result } = info;
// if (result.errors) {
// const afterErrorHook = typeof this.config.hooks.afterError === 'function' ? this.config.hooks.afterError : null;
// this.errorExtensions = await errorHandler(info, this.config.debug, afterErrorHook);
// }
// return null;
// };
}
init(req, res) {
return graphQLHTTP({
schema: this.schema,
customFormatErrorFn: () => {
const response = {
...this.errorExtensions[this.errorExtensionIteration],
};
this.errorExtensionIteration += 1;
return response;
},
extensions: this.extensions,
// customFormatErrorFn: () => {
// const response = {
// ...this.errorExtensions[this.errorExtensionIteration],
// };
// this.errorExtensionIteration += 1;
// return response;
// },
// extensions: this.extensions,
context: { req, res },
});
}