error()
Sets the error message for the previously failed check(s).
error(message: StringConvertible): this;
Notes
- Multiple calls are allowed; each sets the error message if the preceding check(s) failed.
Parameters
- message — The error message to use.
Return value
This builder, for chaining.
Examples
f.string().error("Not a string");
f.union(f.string(), f.number()).error("Not a string or number");
f.number().error("Not a number").positive().error("Must be positive");
Related
class Builder static
A class that represents a validation builder for an input value.
