Skip to content

Commit ec97284

Browse files
committed
Don't add errors to ExecutionResult if are empty. Fixed #111
1 parent 0ed2bc2 commit ec97284

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

graphql/execution/executor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ def on_rejected(error):
7575
return None
7676

7777
def on_resolve(data):
78+
if not context.errors:
79+
return ExecutionResult(data=data)
7880
return ExecutionResult(data=data, errors=context.errors)
7981

8082
promise = Promise(executor).catch(on_rejected).then(on_resolve)

graphql/execution/experimental/executor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def on_rejected(error):
4545
return None
4646

4747
def on_resolve(data):
48+
if not context.errors:
49+
return ExecutionResult(data=data)
4850
return ExecutionResult(data=data, errors=context.errors)
4951

5052
promise = Promise(executor).catch(on_rejected).then(on_resolve)

0 commit comments

Comments
 (0)