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

enhancement: DjangoDebugContext captures exceptions #1122

Merged
merged 2 commits into from Mar 2, 2021

Conversation

zbyte64
Copy link
Collaborator

@zbyte64 zbyte64 commented Feb 16, 2021

DjangoDebugContext captures exceptions and allows captured stack traces to be queried. Example usage added to documentation.

Fixes #1121

Discovered that next does not return a promise in our test environment. Do I need to check if the return is a promise?

Copy link
Collaborator

@tcleonard tcleonard left a comment

Choose a reason for hiding this comment

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

Awesome! Was looking for that for a while!

@tcleonard
Copy link
Collaborator

Discovered that next does not return a promise in our test environment. Do I need to check if the return is a promise?

Just saw that comment... not sure why next does not return a promise in the first place, but what is the implication of this?

@zbyte64
Copy link
Collaborator Author

zbyte64 commented Feb 23, 2021

Could mean an exception might get raised and not logged. Or maybe the variable name is incorrect. My current understanding is it gets call by this: https://github.com/graphql-python/graphql-core/blob/6494c7fcfa62418a4fe36cf23e0bbfebc10fe342/src/graphql/execution/middleware.py#L36 which doesn't seem to do anything with promises...

@zbyte64 zbyte64 merged commit e9f25ec into main Mar 2, 2021
@zbyte64 zbyte64 deleted the debug-middleware-print-stack-v3 branch March 2, 2021 18:45
@khink
Copy link

khink commented Feb 2, 2023

The try-except around promise = next(root, info, **args) in e9f25ec is the cause of issue #1367. It makes raising a GraphQLError return a "Promise rejected" instead of an "errors" list. From what i can gather, raising GraphQLError is a pattern that is supported throughout Graphene.

If the try-except could be removed, that would make graphene-django work more as people might expect, i think.

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.

Print exception traceback of GraphQLLocatedError
3 participants