Skip to content

Provide mechanism for just mapping an exception to a status code and use the default error handling afterwards #7349

Closed as not planned
@mvitz

Description

@mvitz

If an exception is directly annotated with @ResponseStatus(HttpStatus.NOT_FOUND) the default error page handling works and a provided template at error/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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions