@ -20,6 +20,8 @@ Creating and maintaining open-source modules is a lot of work. A donation is als
The constructor for `validatem`'s `ValidationError` type. This is invoked like any other `Error` constructor, but you may optionally pass extra metadata that should be stored on the error.
The constructor for `validatem`'s `ValidationError` type. This is invoked like any other `Error` constructor, but you may optionally pass extra metadata that should be stored on the error.
__Note that, for performance reasons (preventing stacktrace collection), the returned object does not *actually* inherit from `Error`!__ This should not affect its correct functioning, considering that the stacktraces of individual validators are not used in Validatem, and `ValidationError`s should never be thrown outside of a validator context anyway.
__Unless you are implementing a parser and using virtual properties, you probably do not need to specify the `path` property.__ Combinators like `arrayOf` will insert their path segments after-the-fact by themselves, your validator does not need to do this.
__Unless you are implementing a parser and using virtual properties, you probably do not need to specify the `path` property.__ Combinators like `arrayOf` will insert their path segments after-the-fact by themselves, your validator does not need to do this.
* __message:__ A description of the validation problem. This should be formatted in such a way that it describes the *requirement*, and *not* how it failed; for example, it should say "Must be a string" rather than "Is not a string".
* __message:__ A description of the validation problem. This should be formatted in such a way that it describes the *requirement*, and *not* how it failed; for example, it should say "Must be a string" rather than "Is not a string".
// NOTE: We don't actually inherit from the real Error here, because collecting stacktraces is very expensive and largely useless for our purposes. Validatem's own error reporting is clear enough, and if not, that's a bug in Validatem anyway.
functionValidationError(message,properties){
this.message=message;
module.exports=createError("ValidationError",{
Object.assign(this,{
path:[],
path:[],
// NOTE: The below are for potential future compatibility logic.