Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
message
and locations
as enumerable properties on GraphQLError.
As brought up in #426, it can be confusing to return instances of `Error` from the `graphql` function since the expectation is that you will call `JSON.stringify` and submit the result to a client. Calling `JSON.stringify` on an instance of `Error` results in `{}` since it has no enumerable properties. In order to have behavior that matches the GraphQL spec easier to achieve, this makes these two properties enumerable. I think this will be the best of both worlds - anyone who wishes the operate directly on the Error instances will still have the ability to do so (for example, to access the `stack` property), but it can still be converted to JSON directly and get a spec-compliant result.
- Loading branch information
Showing
7 changed files
with
94 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters