File tree 1 file changed +5
-22
lines changed
1 file changed +5
-22
lines changed Original file line number Diff line number Diff line change @@ -668,9 +668,9 @@ function completeValue(
668
668
throw result ;
669
669
}
670
670
671
- // If field type is NonNull , complete for inner type, and throw field error
671
+ // If field type is non-nullable , complete for inner type, and throw field error
672
672
// if result is null.
673
- if ( isNonNullType ( returnType ) ) {
673
+ if ( isNonNullType ( returnType ) || isSemanticNonNullType ( returnType ) ) {
674
674
const completed = completeValue (
675
675
exeContext ,
676
676
returnType . ofType ,
@@ -681,26 +681,9 @@ function completeValue(
681
681
) ;
682
682
if ( completed === null ) {
683
683
throw new Error (
684
- `Cannot return null for non-nullable field ${ info . parentType . name } .${ info . fieldName } .` ,
685
- ) ;
686
- }
687
- return completed ;
688
- }
689
-
690
- // If field type is SemanticNonNull, complete for inner type, and throw field error
691
- // if result is null.
692
- if ( isSemanticNonNullType ( returnType ) ) {
693
- const completed = completeValue (
694
- exeContext ,
695
- returnType . ofType ,
696
- fieldNodes ,
697
- info ,
698
- path ,
699
- result ,
700
- ) ;
701
- if ( completed === null ) {
702
- throw new Error (
703
- `Cannot return null for semantic-non-nullable field ${ info . parentType . name } .${ info . fieldName } .` ,
684
+ `Cannot return null for ${
685
+ isSemanticNonNullType ( returnType ) ? 'semantically ' : ''
686
+ } non-nullable field ${ info . parentType . name } .${ info . fieldName } .`,
704
687
) ;
705
688
}
706
689
return completed ;
You can’t perform that action at this time.
0 commit comments