File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/GraphQL.Client.LocalExecution Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -79,8 +79,11 @@ private async Task<GraphQLResponse<TResponse>> ExecuteQueryAsync<TResponse>(Grap
7979 private async Task < IObservable < GraphQLResponse < TResponse > > > ExecuteSubscriptionAsync < TResponse > ( GraphQLRequest request , CancellationToken cancellationToken = default )
8080 {
8181 var result = await ExecuteAsync ( request , cancellationToken ) ;
82- return ( ( SubscriptionExecutionResult ) result ) . Streams ? . Values . SingleOrDefault ( ) ?
83- . SelectMany ( executionResult => Observable . FromAsync ( token => ExecutionResultToGraphQLResponse < TResponse > ( executionResult , token ) ) ) ;
82+ var stream = ( ( SubscriptionExecutionResult ) result ) . Streams ? . Values . SingleOrDefault ( ) ;
83+
84+ return stream == null
85+ ? Observable . Throw < GraphQLResponse < TResponse > > ( new InvalidOperationException ( "the GraphQL execution did not return an observable" ) )
86+ : stream . SelectMany ( executionResult => Observable . FromAsync ( token => ExecutionResultToGraphQLResponse < TResponse > ( executionResult , token ) ) ) ;
8487 }
8588
8689 private async Task < ExecutionResult > ExecuteAsync ( GraphQLRequest request , CancellationToken cancellationToken = default )
You can’t perform that action at this time.
0 commit comments