|How to handle validation problems? [message #1108300]
||Fri, 13 September 2013 16:54
| Maarten Bezemer
Registered: February 2012
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!
Powered by FUDForum
. Page generated in 0.12279 seconds