@@ -330,21 +330,23 @@ where
330330 } ) ) ,
331331 ) ) ;
332332 }
333- } else if let Ok ( Value :: Null ) = sub_result {
334- // NOTE: Executing a fragment cannot really result in a `Value::Null`,
335- // because it represents a set of fields, so normal execution always
336- // results in a `Value::Object`. However, a `Value::Null` is used here
337- // to indicate that fragment execution failed somewhere and, because
338- // of non-`null` types involved, its error should be propagated to the
339- // parent field.
333+ } else {
334+ if let Err ( e) = sub_result {
335+ sub_exec. push_error_at ( e, span. start ) ;
336+ }
337+ // NOTE: Executing a fragment cannot really result in anything other
338+ // than `Value::Object`, because it represents a set of fields.
339+ // So, if an error happens or a `Value::Null` is returned, it's an
340+ // indication that the fragment execution failed somewhere and,
341+ // because of non-`null` types involved, its error should be
342+ // propagated to the parent field, which is done here by returning
343+ // a `Value::Null`.
340344 async_values. push_back ( AsyncValueFuture :: Field2 ( future:: ready (
341345 AsyncValue :: Field ( AsyncField {
342346 name : String :: new ( ) , // doesn't matter here
343347 value : None ,
344348 } ) ,
345349 ) ) ) ;
346- } else if let Err ( e) = sub_result {
347- sub_exec. push_error_at ( e, span. start ) ;
348350 }
349351 }
350352 }
@@ -387,21 +389,23 @@ where
387389 } ) ) ,
388390 ) ) ;
389391 }
390- } else if let Ok ( Value :: Null ) = sub_result {
391- // NOTE: Executing a fragment cannot really result in a `Value::Null`,
392- // because it represents a set of fields, so normal execution
393- // always results in a `Value::Object`. However, a `Value::Null`
394- // is used here to indicate that fragment execution failed
395- // somewhere and, because of non-`null` types involved, its error
396- // should be propagated to the parent field.
392+ } else {
393+ if let Err ( e) = sub_result {
394+ sub_exec. push_error_at ( e, span. start ) ;
395+ }
396+ // NOTE: Executing a fragment cannot really result in anything other
397+ // than `Value::Object`, because it represents a set of fields.
398+ // So, if an error happens or a `Value::Null` is returned, it's an
399+ // indication that the fragment execution failed somewhere and,
400+ // because of non-`null` types involved, its error should be
401+ // propagated to the parent field, which is done here by returning
402+ // a `Value::Null`.
397403 async_values. push_back ( AsyncValueFuture :: Field2 ( future:: ready (
398404 AsyncValue :: Field ( AsyncField {
399405 name : String :: new ( ) , // doesn't matter here
400406 value : None ,
401407 } ) ,
402408 ) ) ) ;
403- } else if let Err ( e) = sub_result {
404- sub_exec. push_error_at ( e, span. start ) ;
405409 }
406410 }
407411 } else {
0 commit comments