Skip to content

Add right stack trace to exception #62

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

Merged
merged 3 commits into from
May 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion graphql/error/located_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def __init__(self, nodes, original_error=None):
else:
message = 'An unknown error occurred.'

if isinstance(original_error, GraphQLError):
if hasattr(original_error, 'stack'):
stack = original_error.stack
else:
stack = sys.exc_info()[2]
Expand Down
2 changes: 2 additions & 0 deletions graphql/execution/executor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import collections
import functools
import logging
import sys

from promise import Promise, is_thenable, promise_for_dict, promisify

Expand Down Expand Up @@ -170,6 +171,7 @@ def resolve_or_error(resolve_fn, source, args, context, info, executor):
logger.exception("An error occurred while resolving field {}.{}".format(
info.parent_type.name, info.field_name
))
e.stack = sys.exc_info()[2]
return e


Expand Down