alejandro-du / crudui

Automatically generate CRUD-like Vaadin views for any Java Bean
https://vaadin.com/directory#!addon/crud-ui-add-on
Apache License 2.0
86 stars 54 forks source link

Exceptions in CRUD operations show success message #82

Closed envas closed 3 years ago

envas commented 3 years ago

Using CrudListener I can delegate the CRUD operations to a custom logical unit. But how to deal with backend errors, For example, when my database raises an error due to referential integrity violation and the delete operation do not perform.

IMO if the CrudListener throws an exception, the error message should be reported and the operation should break. This should be a part of the framework. Currently, a success message is reported even if the backend operation fails - showNotification(successMessage) is optimistic hard coded.

operationPerformedClickEvent -> {
            buttonClickListener.onComponentEvent(operationPerformedClickEvent);
            if (!clickRowToUpdate) {
                crudLayout.hideForm();
            }
            showNotification(successMessage);