ExecutionResult.formatted does not format errors
See original GitHub issueWhen I call formatted on an ExecutionResult, the errors portion of the dict is not formatted and instead returns a list of GraphQLErrors. GraphQLError is not serializable, but it does have a formatted property which is, why is formatted not called on the list of GraphQLErrors?
As a work around, I have to call formatted on my ExecutionResult and then rebuild the dict and format the errors:
formatted = result.formatted
data = formatted.get('data')
errors = ([err.formatted for err in formatted.get('errors')]
if formatted.get('errors') is not None
else None)
extensions = formatted.get('extensions')
if extensions:
body = dict(data=data, errors=errors, extensions=extensions)
else:
body = dict(data=data, errors=errors)
Ideally ExecutionResult.formatted would perform this error formatting for me.
Environment: python 3.8 graphql-core 3.1.4
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Log error if YAPF formatting fails · Issue #12362 - GitHub
I have YAPF installed and setup to format my python files in-place on save. However, sometimes it appears to run but it doesn't...
Read more >Error — GraphQL-core 3 3.3.0a2 documentation
The graphql.error package is responsible for creating and formatting GraphQL errors. ... A GraphQLError describes an Error found during the parse, validate, or ......
Read more >Handling Errors - graphql-php
When the result is converted to a serializable array using its toArray() method, all errors are converted to arrays as well using default...
Read more >Getting "Extension 'Python Language Basics' cannot format ~'/'"
When I try to use the Format Document command, I get an error that says "Python auto formatting: Extension 'Python Language Basics' cannot ......
Read more >Data format error: We couldn't convert to Number. Details
The query that uses this Excel file loads fine, no errors. It's a different query, where I join that table with another one,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Don’t worry. The execution results and errors are not automatically formatted. We’re only talking about the case when you access the
formattedproperty of these objects. With other words, if you access the errors of the execution result, they will be still a list of GraphQLErrors, if you access the errors of the formatted execution result, they will be a list of formatted GraphQLErrors.Right, sorry let me rephrase.
If
GraphQLError’s are automatically formatted when being put into the result, is there any way of accessing traceback data? I had thought the accepted way was by looking atoriginal_error.__traceback__, which would no longer be possible if this was changed.