JVM | Platform | Status |
---|---|---|
OpenJDK (Temurin) Current | Linux | |
OpenJDK (Temurin) LTS | Linux | |
OpenJDK (Temurin) Current | Windows | |
OpenJDK (Temurin) LTS | Windows |
JavaFX component for displaying error dialogs.
- Display error dialogs containing structured errors.
- Written in pure Java 21.
- OSGi-ready
- JPMS-ready
- ISC license.
Given a structured error value:
SStructuredErrorType<String> error;
Create a new dialog and display it:
MSErrorDialogs.builder(error)
.build()
.showAndWait();
The contents of the dialog depends on the data present in the error value.
If only a message is present, the message will be displayed:
If attributes are present, they will be displayed in a table below the message:
If an exception is present, it will be displayed:
If a remediating action is present, it will be displayed:
Any combination of the above is possible:
If a reporting callback is provided to the builder, it will be evaluated when the user clicks the provided Report button. If no callback is provided, the Report button is disabled. The callback should be tied to your application's error reporting functionality.
MSErrorDialogs.builder(error)
.setErrorReportCallback(() -> {
LOG.debug("Pretending to send an error report...");
})
.build()
.showAndWait();
All elements within an error dialog are assigned CSS classes:
A custom stylesheet can be specified to the dialog builder:
MSErrorDialogs.builder(error)
.setCSS(URI.create("/path/to/custom.css"))
.build()
.showAndWait();
With great power comes great responsibility.
A demo application is included.