Skip to content
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

Re-create UnforgivingExecutionContext for graphql-core 3.1.5+ #1369

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexhafner
Copy link

This pull request addresses the issue in #1368 where we want to be able to use UnforgivingExecutionContext to deal with unexpected errors. The tests for UnforgivingExecutionContext are re-instated as they were before efc0353#diff-dc90fef2a8de7ab6853d36140a9149eef3342af69e7d5f95e34b3fe2a9a8ebe1, and a slightly adapted of the fix proposed by @weilu #1255 (comment) is implemented for UnforgivingExecutionContext itself. The modified version differentiates between GraphQLError, which it leaves to be handled by graphql-core and other errors, which it treats as unexpected and raises with the original error. This should also fix the tests failing per #1346.

error: GraphQLError,
return_type,
) -> None:
if type(error.original_error) is GraphQLError:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our project, I had to change this to isinstance(error.original_error, GraphQLError).

We have a few subclasses of GraphQLError to support transformations from different data types using OurGraphQLError.from_other_error(...). This makes it easier to support extension's within the errors.

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

Successfully merging this pull request may close these issues.

None yet

2 participants