From f42563424e2e037c1da7233173e39ba026a60568 Mon Sep 17 00:00:00 2001 From: rstoyanchev Date: Wed, 9 Mar 2022 12:26:45 +0000 Subject: [PATCH] Do not create "error" message from ExecutionResult Fix gh-320 --- .../graphql/web/webflux/GraphQlWebSocketHandler.java | 7 ++++--- .../graphql/web/webmvc/GraphQlWebSocketHandler.java | 5 ++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlWebSocketHandler.java b/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlWebSocketHandler.java index 74cc28cb..8fe56974 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlWebSocketHandler.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/web/webflux/GraphQlWebSocketHandler.java @@ -197,9 +197,8 @@ public class GraphQlWebSocketHandler implements WebSocketHandler { }); } else { - // Single response (query or mutation) - outputFlux = (CollectionUtils.isEmpty(output.getErrors()) ? Flux.just(output) : - Flux.error(new IllegalStateException("Execution failed: " + output.getErrors()))); + // Single response (query or mutation) that may contain errors + outputFlux = Flux.just(output); } return outputFlux @@ -236,4 +235,6 @@ public class GraphQlWebSocketHandler implements WebSocketHandler { private static class SubscriptionExistsException extends RuntimeException { } + + } diff --git a/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlWebSocketHandler.java b/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlWebSocketHandler.java index 50fb2079..ba71c095 100644 --- a/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlWebSocketHandler.java +++ b/spring-graphql/src/main/java/org/springframework/graphql/web/webmvc/GraphQlWebSocketHandler.java @@ -238,9 +238,8 @@ public class GraphQlWebSocketHandler extends TextWebSocketHandler implements Sub }); } else { - // Single response (query or mutation) - outputFlux = (CollectionUtils.isEmpty(output.getErrors()) ? Flux.just(output) - : Flux.error(new IllegalStateException("Execution failed: " + output.getErrors()))); + // Single response (query or mutation) that may contain errors + outputFlux = Flux.just(output); } return outputFlux