Skip to content

Commit 190069d

Browse files
committed
Restructure code in subscribe_fields() and add comment
1 parent 42dbced commit 190069d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

graphql/execution/executor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,13 @@ def map_result(data):
283283
subscriber_exe_context.reset()
284284
return result
285285

286+
def catch_error(error):
287+
subscriber_exe_context.errors.append(error)
288+
return Observable.just(None)
289+
286290
observables = [] # type: List[Observable]
287291

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

290295
for response_name, field_asts in fields.items():
@@ -297,11 +302,6 @@ def map_result(data):
297302
)
298303
if result is Undefined:
299304
continue
300-
301-
def catch_error(error):
302-
subscriber_exe_context.errors.append(error)
303-
return Observable.just(None)
304-
305305
# Map observable results
306306
observable = result.catch_exception(catch_error).map(
307307
lambda data: map_result({response_name: data})

0 commit comments

Comments
 (0)