Skip to content

Commit

Permalink
Restructure code in subscribe_fields() and add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito committed Jan 24, 2020
1 parent 42dbced commit 190069d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions graphql/execution/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,13 @@ def map_result(data):
subscriber_exe_context.reset()
return result

def catch_error(error):
subscriber_exe_context.errors.append(error)
return Observable.just(None)

observables = [] # type: List[Observable]

# TODO: Make sure this works with multiple fields (currently untested)
# assert len(fields) == 1, "Can only subscribe one element at a time."

for response_name, field_asts in fields.items():
Expand All @@ -297,11 +302,6 @@ def map_result(data):
)
if result is Undefined:
continue

def catch_error(error):
subscriber_exe_context.errors.append(error)
return Observable.just(None)

# Map observable results
observable = result.catch_exception(catch_error).map(
lambda data: map_result({response_name: data})
Expand Down

0 comments on commit 190069d

Please sign in to comment.