Skip to content

Commit 58c64cb

Browse files
committed
Consistent fallback to NoUpgradeStrategyWebSocketService
Closes gh-33970
1 parent 3074116 commit 58c64cb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

spring-webflux/src/main/java/org/springframework/web/reactive/config/WebFluxConfigurationSupport.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,9 @@ private WebSocketService initWebSocketService() {
485485
try {
486486
service = new HandshakeWebSocketService();
487487
}
488-
catch (IllegalStateException ex) {
488+
catch (Throwable ex) {
489489
// Don't fail, test environment perhaps
490-
service = new NoUpgradeStrategyWebSocketService();
490+
service = new NoUpgradeStrategyWebSocketService(ex);
491491
}
492492
}
493493
return service;
@@ -608,9 +608,15 @@ public void validate(@Nullable Object target, Errors errors) {
608608

609609
private static final class NoUpgradeStrategyWebSocketService implements WebSocketService {
610610

611+
private final Throwable ex;
612+
613+
public NoUpgradeStrategyWebSocketService(Throwable ex) {
614+
this.ex = ex;
615+
}
616+
611617
@Override
612618
public Mono<Void> handleRequest(ServerWebExchange exchange, WebSocketHandler webSocketHandler) {
613-
return Mono.error(new IllegalStateException("No suitable RequestUpgradeStrategy"));
619+
return Mono.error(new IllegalStateException("No suitable RequestUpgradeStrategy", this.ex));
614620
}
615621
}
616622

0 commit comments

Comments
 (0)