Error Window Add-on
This add-on allows to add a sub-window to inform that an error was caused by an exception.
The sub-window shows different information depending on the running mode of the application:
- if the application is running in debug mode, it shows the stack trace of the exception.
- if the application is running in production mode, it shows a code to report that can be found in log files.
The dialog (ErrorWindow) can be automatically invoked through an error handler configured by com.flowingcode.vaadin.addons.errorwindow.VaadinServiceInitListenerImpl
or just by itself calling ErrorManager.showError()
. It is also possible to use the ErrorWindow directly for messages customization purposes.
Sample code
final Button errorButton = new Button("Throw Error", new ClickListener() { @Override public void buttonClick(final ClickEvent event) { Integer.parseInt("asdf"); } }); errorButton.setErrorHandler(new WindowErrorHandler(this));
Button throwErrorWithoutErrorHandler = new Button("Throw Error without an error handler", ev->{ try { Integer.parseInt("asdf"); } catch (NumberFormatException e) { ErrorManager.showError(e); } });
Button throwErrorWithCustomMessage = new Button("Throw Error with custom message", ev->{ try { Integer.parseInt("asdf"); } catch (NumberFormatException e) { ErrorWindow w = new ErrorWindow(e, "CUSTOM ERROR MESSAGE"); w.open(); } });
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Bug fixes:
- fix compatibility with Vaadin 24.0.0.alpha6 (#53)
New features:
- add i18n support (#43)
- Released
- 2023-02-22
- Maturity
- STABLE
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 14
- Vaadin 22
- Vaadin 23
- Vaadin 24
- Vaadin 14+ in 3.3.0
- Vaadin 8.0+ in 2.0.1
- Vaadin 7.7+ in 1.0.0
- Browser
- N/A