Re: ValidationException and Barracuda revision 237+
Franck Routier <[email protected]> Wed, 08 Jun 2011 10:39:17 +0200
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <1307522357.2249.42.camel@franck-VPCCW2S1E> |
This is a multi-part message in MIME format... ------------=_1307522814-26124-1884 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Hi Shawn, I have re-used the concept of "deferred" exception with Simpleorm to handle orm level validation, and doing this I came to the conclusion that the concept was cool, but the way it was handled in Barracuda was a mess. Here is what I think : 1) either the exception is deferred, or it is not. If it is not, it shouldn't be a container, as it is thrown right after the first error. If it is deferred, then it has to be a container, as it might contain many errors. 2) If the exception is a container, it could be a meaningful error in itself, or just a container. But allowing multiple levels of subexceptions (containers into containers) is much harder to implement. You have to check each parent, then each child, then each child children, etc. Instead of going into a recursive approach, using a flat list structure (a container and one level of errors) is much simpler, less bug-prone, and will give the same value to the user. 3) the only reason to add sub-exceptions to a non-deferred ValidationException was to carry out information about several fields. So I added the possibility to have a list of fields as the exception source. The need for ValidationException to be a container disappears. This seems much cleaner to me. The downside is that you have to handle both exception in a different way. BUT I admit I was not expecting existing projects (except mine) to migrate (as you mentioned, the list has been quiet these last... years :) So, either you think you can migrate your code to this new structure, or you can't. Then, I think we can re-add the missing method, only deprecating them and adding warning on the way to (not) use them in the docs... What do you think ? Regards, Franck ------------=_1307522814-26124-1884 Content-Type: text/plain; charset="UTF-8"; name="message-footer.txt" Content-Disposition: inline; filename="message-footer.txt" Content-Transfer-Encoding: quoted-printable =0D --=0D Barracuda mailing list=0D [email protected]=0D http://www.ow2.org/wws/lists/projects/barracuda=0D ------------=_1307522814-26124-1884--