Hello,
On Sep 30, 9:21 pm, Fabien POTENCIER <[EMAIL PROTECTED]
project.com> wrote:
> Why do you want error codes? Do you want something like this?
> throw new sfValidatorException('string_too_large');
Using exception here makes little sense. There is nothing wrong
happening, when I call a validation method I expect it to succeed or
fail. An exception can be raised if the input cannot be processed or
if a db connection failed (for complex validation).
There is already a validator instance, it can store a verbose
explanation about the validation error. Having the verbose error in
the object and the method returning a boolean keeps it simple and
flexible. I can't imagine to use exceptions for something as simple as
data validation.
Sanitization is really another topic and can rarely fail. Only complex
validation (ie with access to external resources) should raise
exceptions and fail, or at the very least when the input argument is
not correct (wrong type, class, etc.).
My 2cents and given my experiences and feedbacks from the filter
extension development or pear validate,
Cheers,
--Pierre
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---