File tree 2 files changed +20
-17
lines changed
2 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -424,6 +424,7 @@ describe('Subscription Initialization Phase', () => {
424
424
{
425
425
message : 'The subscription field "unknownField" is not defined.' ,
426
426
locations : [ { line : 1 , column : 16 } ] ,
427
+ path : [ 'unknownField' ] ,
427
428
} ,
428
429
] ,
429
430
} ) ;
Original file line number Diff line number Diff line change @@ -1127,27 +1127,29 @@ function executeSubscription(
1127
1127
rootType ,
1128
1128
operation . selectionSet ,
1129
1129
) ;
1130
- const [ responseName , fieldNodes ] = [ ...rootFields . entries ( ) ] [ 0 ] ;
1131
- const fieldName = fieldNodes [ 0 ] . name . value ;
1132
- const fieldDef = schema . getField ( rootType , fieldName ) ;
1133
-
1134
- if ( ! fieldDef ) {
1135
- throw new GraphQLError (
1136
- `The subscription field "${ fieldName } " is not defined.` ,
1137
- { nodes : fieldNodes } ,
1138
- ) ;
1139
- }
1140
1130
1131
+ const [ responseName , fieldNodes ] = [ ...rootFields . entries ( ) ] [ 0 ] ;
1141
1132
const path = addPath ( undefined , responseName , rootType . name ) ;
1142
- const info = buildResolveInfo (
1143
- exeContext ,
1144
- fieldDef ,
1145
- fieldNodes ,
1146
- rootType ,
1147
- path ,
1148
- ) ;
1149
1133
1150
1134
try {
1135
+ const fieldName = fieldNodes [ 0 ] . name . value ;
1136
+ const fieldDef = schema . getField ( rootType , fieldName ) ;
1137
+
1138
+ if ( ! fieldDef ) {
1139
+ throw new GraphQLError (
1140
+ `The subscription field "${ fieldName } " is not defined.` ,
1141
+ { nodes : fieldNodes } ,
1142
+ ) ;
1143
+ }
1144
+
1145
+ const info = buildResolveInfo (
1146
+ exeContext ,
1147
+ fieldDef ,
1148
+ fieldNodes ,
1149
+ rootType ,
1150
+ path ,
1151
+ ) ;
1152
+
1151
1153
// Implements the "ResolveFieldEventStream" algorithm from GraphQL specification.
1152
1154
// It differs from "ResolveFieldValue" due to providing a different `resolveFn`.
1153
1155
You can’t perform that action at this time.
0 commit comments