Revise UI Error
Fractal’s Error
struct used for displaying errors in the UI might need a bit of pondering.
I think
- its purpose should be to convey i18n’ed errors from their source to the UI to be displayed in the form of fancy Labels.
- it should have a minimal interface as it will be used all over the application.
- it should be informational.
Currently the Error takes the “original” error in form of a MatrixError
. This, for one, is inflexible as there can be other types of errors at the source. More generally, I don’t see why we should keep this field in the Error struct at all as it does not serve the purpose. To support this point, this functionality is not used anywhere in the current code base.
Then it has setter methods for the widget builder. I don’t see why being able to change the factory closure after creation might be useful.
The last point is about actually getting infos to the user: The Error takes a factory closure at creation time and only when it is about to be displayed the actual widget is created. This might save resources, but has the drawback that things the closure references might no longer exist. This in turn leads to the user not getting sensible feedback about what happened.
I suggest to remove the MatrixError and the setter methods entirely, and I’m tending towards storing the generated labels directly instead of using a lazy closure for a bit more reliability.