vaadin / vaadin/framework

Add possibility to handle backend errors in Binder write

Open
#10,392 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

At the moment a Binder validates UI input (with UI rules), writes the input data to the bean and finishes the input (sets hasChanges=false).

For a real live application this is not enough because the data in the bean has to be processed (saved in a database for example). As long as the data is not processed, the input has to stay open.
If there is an error in processing the input (the bean data) in the backend, the UI has to look like after an Binder validation error. The user needs the possibility to correct the input and try again without loosing the existing input.

I could imagine a callback function or lambda called in Binder.doWriteIfValid(BEAN) after validation and after write values in the case hasErrors==false. The callback could process the bean data in the backend, catch backend errors and return them to the Binder.
If there are backend errors, the Binder resets the bean values and does not set hasChanges=true (as he does if hasErrors==true). This way the User does not loose any input and can handle the backend problem like he handles validation problems.

There is a forum thread about this problem. https://vaadin.com/forum/#!/thread/16877326

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Binder.doWriteIfValid(BEAN), which the issue identifies as the integration point after validation and writing values. Review the linked forum discussion for the proposed backend-error handling. Done should keep the input open, preserve user input, reset bean values, and expose backend errors like validation errors when processing fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
full-stack
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.