Skip to content

Allow for external customization and i8n of the "detail" of an RFC 7807 response #28814

Closed
@rstoyanchev

Description

@rstoyanchev

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.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions