Skip to content

The FieldError class does not provide access to the exception that triggered the binding error. [SPR-16372] #20919

Closed
@spring-projects-issues

Description

@spring-projects-issues

Razvan Popian opened SPR-16372 and commented

It would be nice if the org.springframework.validation.FieldError class would provide access to the actual exception that triggered the binding error. That exception might be thrown in a Converter or Formatter and it could be helpful for somebody who is trying to get more details about why a certain field failed to bind.
Currently the org.springframework.validation.FieldError class does store the exception message, but it would be better if it would store the actual exception (See the org.springframework.validation.DefaultBindingErrorProcessor#processPropertyAccessException method).
There are definetely workarrounds to achieve this by extending FieldError and by injecting a custom BindingErrorProcessor in the DataBinder, but I think it would be nice if the framework would do this out of the box.


Affects: 4.3.6

Issue Links:

Referenced from: pull request #1654

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)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