Skip to content

Commit 9591078

Browse files
committed
Merge pull request #62 from Globegitter/patch-1
Add right stack trace to exception
2 parents c93143a + e398c53 commit 9591078

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

graphql/error/located_error.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, nodes, original_error=None):
1313
else:
1414
message = 'An unknown error occurred.'
1515

16-
if isinstance(original_error, GraphQLError):
16+
if hasattr(original_error, 'stack'):
1717
stack = original_error.stack
1818
else:
1919
stack = sys.exc_info()[2]

graphql/execution/executor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import collections
22
import functools
33
import logging
4+
import sys
45

56
from promise import Promise, is_thenable, promise_for_dict, promisify
67

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

175177

0 commit comments

Comments
 (0)