Skip to content

Commit 798b378

Browse files
committed
Polish "Add support for @ResponseStatus in DefaultErrorAttributes"
Closes gh-14744
1 parent 1791974 commit 798b378

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/reactive/error/DefaultErrorAttributes.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,33 +94,26 @@ private HttpStatus determineHttpStatus(Throwable error) {
9494
if (error instanceof ResponseStatusException) {
9595
return ((ResponseStatusException) error).getStatus();
9696
}
97-
9897
ResponseStatus responseStatus = AnnotatedElementUtils
9998
.findMergedAnnotation(error.getClass(), ResponseStatus.class);
100-
10199
if (responseStatus != null) {
102100
return responseStatus.code();
103101
}
104-
105102
return HttpStatus.INTERNAL_SERVER_ERROR;
106103
}
107104

108105
private String determineMessage(Throwable error) {
109106
if (error instanceof WebExchangeBindException) {
110107
return error.getMessage();
111108
}
112-
113109
if (error instanceof ResponseStatusException) {
114110
return ((ResponseStatusException) error).getReason();
115111
}
116-
117112
ResponseStatus responseStatus = AnnotatedElementUtils
118113
.findMergedAnnotation(error.getClass(), ResponseStatus.class);
119-
120114
if (responseStatus != null) {
121115
return responseStatus.reason();
122116
}
123-
124117
return error.getMessage();
125118
}
126119

0 commit comments

Comments
 (0)