Allow customization of AppUI error management

Hi

AppUI.showCriticalExceptionMessage() is very basic, does not even use its Exception parameter, and cannot be extended (at least I see no trivial way).

It would be nice if we can hook up a Factory in there to produce the Vaadin form.

For instance, instead of retrying the application initialization we would like to be able to define a redirection to another url.

Mike

Hi,

You can extend AppUI in your application and override showCriticalExceptionMessage method:

  1. Create CustomAppUI class in web module:
public class CustomAppUI extends AppUI {
    @Override
    protected void showCriticalExceptionMessage(Exception exception) {
        // todo do something
    }
}
  1. Register it in web-spring.xml config:
<bean id="cuba_AppUI" class="com.company.appui.web.CustomAppUI" scope="vaadin"/>

Now, you can implement custom exception handling in AppUI.

Iā€™m not sure that we should provide additional flexibility there, since this exception handler is used only if the initial page cannot be rendered and an exception caught during the page opening.

1 Like

Perfect, thanks Yuriyy. I tend to forget how extensible CUBA is. Indeed no need to do more regarding flexibility.