Skip to content

Commit 4831d38

Browse files
committed
Lower log level for ResponseStatusException
Issue: SPR-16049
1 parent e9187da commit 4831d38

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

spring-web/src/main/java/org/springframework/web/server/ResponseStatusException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ public String getReason() {
8787
}
8888

8989
@Override
90-
@Nullable
9190
public String getMessage() {
92-
String msg = "Response status " + this.status + (this.reason != null ? " with reason \"" + reason + "\"" : "");
91+
String msg = "Response status " + this.status +
92+
(this.reason != null ? " with reason \"" + reason + "\"" : "");
9393
return NestedExceptionUtils.buildMessage(msg, getCause());
9494
}
9595

spring-web/src/main/java/org/springframework/web/server/handler/ResponseStatusExceptionHandler.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,13 @@ public class ResponseStatusExceptionHandler implements WebExceptionHandler {
3535

3636
private static final Log logger = LogFactory.getLog(ResponseStatusExceptionHandler.class);
3737

38+
3839
@Override
3940
public Mono<Void> handle(ServerWebExchange exchange, Throwable ex) {
4041
if (ex instanceof ResponseStatusException) {
4142
exchange.getResponse().setStatusCode(((ResponseStatusException) ex).getStatus());
42-
if (ex.getMessage() != null) {
43-
logger.error(ex.getMessage());
44-
}
45-
return Mono.empty();
43+
logger.debug(ex.getMessage());
44+
return exchange.getResponse().setComplete();
4645
}
4746
return Mono.error(ex);
4847
}

0 commit comments

Comments
 (0)