This repository has been archived by the owner on Sep 10, 2019. It is now read-only.
Errors do not bubble up to formatError
#6
Labels
formatError
#6
Summary
I'm creating an issue here so you're aware, but I ultimately believe this is an issue with graphql-tools. When throwing a GrampsError, graphql-tools removes all properties except
error.message
and rethrows a new error. As a result, theformatError
provided by the@gramps/errors
package is useless.Walkthrough
When a GrampsError is thrown, it is caught by graphql-tools stitching logic and rethrown:
https://github.com/apollographql/graphql-tools/blob/master/src/stitching/errors.ts#L84
Later, the new error bubbles up to the formatError logic from
@gramps/errors
:However, the formatError function does not receive the expected GrampsErrors, rather, it receives a different error object transformed and rethrown by graphql-tools. It cannot log the targetEndpoint, statusCode, docsLink, and other fields on a GrampsError because the error has been caught and rethrown by graphql-tools.
I can write a short gist to reproduce it if you want.
The text was updated successfully, but these errors were encountered: