Closed paglias closed 10 years ago
@paglias this sounds useful. For the error do you envision error.validationErrors
? I'll implement later today.
@rschmukler the property name is the same for me, storing only validation erros, even error.errors
would be fine. To make it more recognizable setting error.name
to something meaningful would be fantastic
For error.name
, what's the advantage compared to err.message
which is already "validation failed""
Well, using a fixed message it's more or less the same. I've suggested using name
because maybe you'll decide to change the message or make it more dynamic (like Validation failed for attrs [attr1, attr2]
or whatever) while the name is more likely to stay as it is.
I think for now the name might be unnecessary. This is based off of my experience with modella. If people do end up requesting dynamic errors I will add a more static name
property. The issue is if we add name
here, we should also add it to things like sync
errors.
I do agree with having error.errors
be made available.
It would be useful to have the errors attached to the validation error when it occurs https://github.com/MokoJs/moko/blob/master/lib/prototype.js#L150
Also setting
error.name
to something meaningful likeValidationError
would make it easier to recognize Moko generated errorsGreat library, thanks :)