Open FedericoQuarin opened 2 months ago
In worked that way until 3.7.0 https://github.com/FlowingCode/ErrorWindowAddon/blob/3502b4887bbac413e1dc49ead79d6da2c1f3517b/src/main/java/com/flowingcode/vaadin/addons/errorwindow/ErrorWindow.java#L304-L316
In version 4.0.0 the method was refactored as https://github.com/FlowingCode/ErrorWindowAddon/blob/16fd293860eeb95e07a03726096c03247c5efe40/src/main/java/com/flowingcode/vaadin/addons/errorwindow/ErrorWindow.java#L306-L318
The default error handler initializes errorMessage
from the throwable.getLocalizedMessage()
(which, regardless of its name, is almost never localized). For unexpected exceptions, it does not make sense to display that information to final users.
You can configure a custom ErrorWindowFactory for a given exception class (and initialize the error window there as you see fit) https://github.com/FlowingCode/ErrorWindowAddon/blob/24aae5a27bff7852529e1afc5997dfc9b2a6045b/src/main/java/com/flowingcode/vaadin/addons/errorwindow/ErrorManager.java#L79-L82
Alternatively, you can provide custom "instructions" and open ErrorWindow
explicitly:
The constructor (Throwable, String)
seems to suggest that the string will be displayed as "instructions" (in production mode) and that it will override the exception message (in development mode). As explained above, this is not the current intention of the API, but we acknowledge that it's not good DX.
Describe the bug
On production mode, the error window is not showing the custom message that was set, just the error code.![errorWindow](https://github.com/FlowingCode/ErrorWindowAddon/assets/54511211/59861bc2-37c4-4ccf-bc1b-b08fc3c0201d)
Expected behavior
No response
Minimal reproducible example
On the demo, setting production mode and clicking Throw Error with custom message
Add-on Version
4.0.1
Vaadin Version
24
Additional information
No response