-
Notifications
You must be signed in to change notification settings - Fork 41.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide mechanism for just mapping an exception to a status code and use the default error handling afterwards #7349
Comments
I just found #7329 which is in some way related. |
Indeed, this is a duplicate of #7329 - closing this now. |
I'm not sure that this is exactly a duplicate of #7329. It would be nice to do something to help with this (even if it's just better documentation). |
Update: my own fault (or misundestanding): no response was generated for NO_CONTENT (204) status code, after switching to any other code the response is there. |
@ZaitsevY You've already said that once. There's no need to spam multiple issues with the same comment. |
@wilkinsona excuse, please, I duplicated after having understood that the first comment went to the closed issue. |
@bclozel I'm uncertain if this is really superseded by the ProblemDetail support because the original problem is still present with Spring Boot 3.0.2. Given the following Spring Boot 3.0.2 application
Hitting |
If an exception is directly annotated with
@ResponseStatus(HttpStatus.NOT_FOUND)
the default error page handling works and a provided template aterror/404.html
is rendered.However when using a custom
@ControllerAdvice
for exception mapping the template isn't rendered because it's now the developers responsibility.What I want is a mechanisms which just allows me to map any exception (which I can not or do not want to annotate) to a HTTP status code and let the default error handling take over the template resolution.
The application at https://github.com/mvitz/spring-boot-exception-handling can be used to demonstrate the current behaviour.
The text was updated successfully, but these errors were encountered: