Error validating verification code java

by  |  07-Oct-2018 08:23

If an is thrown from an async validator the argument passed to the rejection handler will be that error.

This allows you to differentiate from coding errors and validation errors.

error validating verification code java-79

The implementation is fairly basic and doesn't do anything clever with the messages.

It doesn't support things like only validating a sub key if the parent key is present so for more advanced validations multiple validation schemas are recommended. Most validators allow you to specify default messages in addition to default options, refer to the documentation for the individual validators for information on how to do this.

The validation constraints can be declared in JSON and shared between clients and the server. One thing that is a bit unorthodox is that most validators will consider undefined values (,) valid values.

So for example adding a constraint of at least 6 characters will be like saying If the attribute is given it must be at least 6 characters.

Besides accepting all options as the non async validation function it also accepts two additional options; clean Attributes which, unless before resolving the promise and wrap Errors which can be a function or constructor that will be called with the errors, options, attributes and constraints if an error occurs.

Community Discussion