From 7854e6e93a29ef5c214327b65c7881d6688593d4 Mon Sep 17 00:00:00 2001 From: Filip Hrisafov Date: Fri, 5 Nov 2021 17:12:17 +0100 Subject: [PATCH] Fix incorrect example for error handling in WebClient exchangeToFlux and exchangeToMono --- .../web/reactive/function/client/WebClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java index 7e8219c1678a..79a7e7615d5b 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java @@ -530,7 +530,7 @@ interface RequestHeadersSpec> { * return response.bodyToMono(ErrorContainer.class); * } * else { - * return Mono.error(response.createException()); + * return response.createException().flatMap(Mono::error); * } * }); * @@ -562,7 +562,7 @@ interface RequestHeadersSpec> { * return response.bodyToMono(ErrorContainer.class).flux(); * } * else { - * return Flux.error(response.createException()); + * return response.createException().flatMap(Flux::error); * } * }); *