Skip to content

Commit 7c956aa

Browse files
committed
Fixed exception printing
1 parent d528fad commit 7c956aa

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

graphql/execution/base.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,14 @@
44
from ..error import GraphQLError
55
from ..language import ast
66
from ..pyutils.default_ordered_dict import DefaultOrderedDict
7-
from ..type.definition import GraphQLInterfaceType, GraphQLUnionType
7+
from ..type.definition import Undefined, GraphQLInterfaceType, GraphQLUnionType
88
from ..type.directives import GraphQLIncludeDirective, GraphQLSkipDirective
99
from ..type.introspection import (SchemaMetaFieldDef, TypeMetaFieldDef,
1010
TypeNameMetaFieldDef)
1111
from ..utils.type_from_ast import type_from_ast
1212
from .values import get_argument_values, get_variable_values
1313

1414

15-
class _Undefined(object):
16-
def __bool__(self):
17-
return False
18-
19-
__nonzero__ = __bool__
20-
21-
22-
Undefined = _Undefined()
23-
24-
2515
class ExecutionContext(object):
2616
"""Data that must be available at all points during query execution.
2717
@@ -93,7 +83,7 @@ def get_argument_values(self, field_def, field_ast):
9383
return result
9484

9585
def report_error(self, error, traceback=None):
96-
sys.excepthook(type(error), str(error), getattr(error, 'stack', None) or traceback)
86+
sys.excepthook(type(error), error, getattr(error, 'stack', None) or traceback)
9787
self.errors.append(error)
9888

9989
def get_sub_fields(self, return_type, field_asts):

graphql/type/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
is_leaf_type,
2020
is_type,
2121
get_nullable_type,
22-
is_output_type
22+
is_output_type,
23+
Undefined
2324
)
2425
from .directives import (
2526
# "Enum" of Directive locations

graphql/type/definition.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
from ..utils.assert_valid_name import assert_valid_name
88

99

10+
class _Undefined(object):
11+
def __bool__(self):
12+
return False
13+
14+
__nonzero__ = __bool__
15+
16+
17+
Undefined = _Undefined()
18+
19+
1020
def is_type(type):
1121
return isinstance(type, (
1222
GraphQLScalarType,

0 commit comments

Comments
 (0)