How to handle validation problems? [message #1108300] |
Fri, 13 September 2013 16:54 |
Maarten Bezemer Messages: 117 Registered: February 2012 |
Senior Member |
|
|
Hello,
Sometimes I am getting a ridiculous amount of validation exceptions (shown in the same amount of dialogs, making my system quite unresponsive).
So I thought it is time to prevent this (e.g. by ignoring validation problems after 10 are found).
With the current EvlValidator class this is not really possible.
The EvlValidator.validate(Resource, Map<Object, Object>) catches exception and show them in a log + dialog.
I have some thoughts about this:
- When an exception is caught, the validation should be canceled... Now it continues, which is not likely the perform the validation correctly.
- The method does not provide means to let the callee know whether an exception occurred... E.g. via a return value or a rethrown exception
My opinion is to cancel the validation when an exception occurs (point 1) and throw a new exception telling what went wrong (point 2), instead of directly logging them.
The newly thrown exception can be caught in the validate(EClass, EObject, DiagnosticChain, Map<Object, Object>) method and added to the log, to keep the default behavior.
But now a custom validator is able to handle them as desired. E.g. keeping a counter and stop showing the exceptions after a certain threshold is reached.
Any additional thoughts about this subject?
Again, I am willing to provide a patch when a consensus is achieved.
Have a good weekend!
Cheers,
Maarten
|
|
|
Re: How to handle validation problems? [message #1108823 is a reply to message #1108300] |
Sat, 14 September 2013 12:24 |
|
Hi Maarten,
Does the attached patch do the trick? Briefly, it terminates the validation process in case of parse problems/exceptions, it introduces a showErrorDialog flag to configure whether the dialog should pop up or not, and adds support for attaching ValidationProblemListeners to an EvlValidator so that clients can be notified when problems are encountered.
Cheers,
Dimitris
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06597 seconds