Description
After #27052, each Spring MVC / WebFlux exception implements ErrorResponse
and exposes ProblemDetail
for the response body. By default, the "detail" field is set to a minimal message (and not than the actual Exception message), to avoid leaking implementation details. An application can extend ResponseEntityExceptionHandler
and override protected methods customize the details for each exception.
We should consider a way to allow customization of the error "detail" for each Spring MVC and WebFlux exception, as well as for any ErrorResponseException
, for example by performing a lookup in a MessageSource
with a message code derived from the exception name. That would allow an application to customize and internationalize exception messages through property files. This is already supported for @ResponseStatus
exceptions, and we could support the same for ErrorResponse
exceptions.
One specific challenge will be the ability to parameterize messages with information that is specific to each exception.