Skip to content

Custom errors get reduced by GraphQLError #251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jardakotesovec opened this issue Nov 25, 2015 · 2 comments
Closed

Custom errors get reduced by GraphQLError #251

jardakotesovec opened this issue Nov 25, 2015 · 2 comments

Comments

@jardakotesovec
Copy link

In some cases we already have custom errors that have extra properties to describe what happened in details, but graphql-js only copies message and stack, so we loose them.

One option would be to keep reference to the original error. Or copy properties from original error - that would be more convenient option.

@leebyron
Copy link
Contributor

leebyron commented Dec 1, 2015

Great suggestion. I decided to keep a reference to the original error to avoid colliding properties, to allow for computed properties, and also to allow for instanceof when necessary.

@leebyron
Copy link
Contributor

leebyron commented Dec 1, 2015

any instance of GraphQLError can now use error.originalError to get the error before it was wrapped and located.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants