FlowingCode / ErrorWindowAddon

Error Window Vaadin Add-on
Apache License 2.0
9 stars 2 forks source link

Idea: support for multiple problems in a single exception #26

Closed mlopezFC closed 3 years ago

mlopezFC commented 3 years ago

Sometimes exceptions can be wrappers carrying out several problems in an "umbrella" exception. It would be great to design a mechanism so a provider can be configured, to extract those multiple problems from an exception, and show them on a grid in the dialog. Given that several problems happened probably they happened in different times, so a column would be needed to inform the date and time of those errors, and then in another column the description.

javier-godoy commented 3 years ago

I'm not sure if "extract[ing] those multiple problems from an exception, and show them on a grid in the dialog" should be part of the addon, but we definitely need some kind of UI provider / extension point (which, in turn, can be implemented in order to provide such feature).

mlopezFC commented 3 years ago

Yes, maybe by just providing some kind of processor that takes the exception as an input and then produces a Vaadin component that can be shown in the dialog as an output would be enough, so any kind of customization can be allowed.

javier-godoy commented 3 years ago

It's already possible with the current API:

  1. Extend ErrorWindow (or implement your own dialog, it doesn't have to be based on ErrorWindow)
  2. Implement a custom ErrorWindowFactory that either unconditionally displays your custom dialog, or displays your custom dialog for some exception types (see #27 for a minor enhancement).
  3. Define a VaadinServiceInitListener that sets the custom factory (ErrorWindowFactory.setErrorWindowFactory).

There is room for improvement in the ErrorWindow class, but that would be better discussed as specific requests for enhancement, such as #28

javier-godoy commented 3 years ago

Assigned to @mlopezFC for discussion or closing.

mlopezFC commented 3 years ago

Excellent analysis. A custom dialog that shows several issues for the same exception is too close to application logic (ie: depends on a specific exception type that is able to "carry" several different errors), so it might be outside the scope of this addon, but at least is good to know that there is a way of doing this using the current API.