Documentation versions (currently viewingVaadin 23)

You are viewing documentation for Vaadin 23. View latest documentation

Exception Handling

How exceptions are handled when using Swing Kit, and how to configure it.

By default, any exception not handled by the remote View, is handled by Swing. As a default behaviour, Swing shows the exception in a JOptionPane. This behaviour can be configured to catch any Vaadin exceptions from Swing, directly.

Manually Handle Vaadin Exceptions

A custom handler for the exception can be used after disabling the default behaviour with the following:


Add a custom exception handler by adding the following:

vaadinPanel.addEventListener(EventType.EXCEPTION, event -> {
    // Print to standard output the exception content

Notice, that the event contains only String values instead of the original Exception. This is to avoid serialization errors due to different classpaths from the Vaadin application and the Swing application.