07-06-2009, 07:10 PM
|
#7 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
As soon as any throw statement is made, the execution stops immediately and moves to the appropriate catch statement or an Exception handler if there is one. It just wouldn't make sense to have a scenario where one wants to throw an exception yet keep the current flow of the code going (for more validation checks, as in your example).
Rather than throwing an exception as soon as a validation problem is identified, it sounds like you will want to collect the errors (if there are any) together during the validation process and only after the validation tests are all complete then throw an exception to be caught elsewhere.
|
|
|
|