Simplify mapping of custom exception to an RFC 7807 response in ResponseEntityExceptionHandler #29384
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
ResponseEntityExceptionHandler
supports RFC 7807 transparently for anyErrorResponse
exception, but as explained in #28814 (comment), what a subclass needs to do to map a custom exception is not as easy as could be. We could add a protected method to create theProblemDetail
and that method could also perform a lookup viaMessageSource
to resolve the detail:This would allow handling a custom exception like this:
The text was updated successfully, but these errors were encountered: