We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 24be647 commit ff6b490Copy full SHA for ff6b490
graphql/execution/base.py
@@ -10,6 +10,7 @@
10
default_resolve_fn,
11
get_field_def
12
)
13
+from ..error.format_error import format_error as default_format_error
14
15
16
class ExecutionResult(object):
@@ -38,6 +39,19 @@ def __eq__(self, other):
38
39
self.invalid == other.invalid
40
41
42
+
43
+ def to_dict(self, format_error=None, dict_class=dict):
44
+ if format_error is None:
45
+ format_error = default_format_error
46
47
+ response = dict_class()
48
+ if self.errors:
49
+ response['errors'] = [format_error(e) for e in self.errors]
50
51
+ if not self.invalid:
52
+ response['data'] = self.data
53
54
+ return response
55
56
57
class ResolveInfo(object):
0 commit comments