This package contains the `ValidationError` type for [`validatem`](https://www.npmjs.com/package/@validatem/core).
__A VERY IMPORTANT NOTE:__ You should *always* use the caret notation (eg. `^1.0.0`) when depending on this package. NPM and Yarn will do this by default when you `npm install @validatem/error` or `yarn add @validatem/error`, but some people turn this off - don't do that here, or things might break!
## Why is this a separate package?
Because it makes forwards compatibility easier. Even if [`@validatem/core`](https://www.npmjs.com/package/@validatem/core) ever needs a breaking release, chances are that the error format remains unchanged. Making the error type separately versionable, means that in that scenario validators should stay compatible with both the old *and* the new version of the core, without validator authors needing to update anything.
## License, donations, and other boilerplate
Licensed under either the [WTFPL](http://www.wtfpl.net/txt/copying/) or [CC0](https://creativecommons.org/publicdomain/zero/1.0/), at your choice. In practice, that means it's more or less public domain, and you can do whatever you want with it. Giving credit is *not* required, but still very much appreciated! I'd love to [hear from you](mailto:firstname.lastname@example.org) if `validatem` was useful to you.
Creating and maintaining open-source modules is a lot of work. A donation is also not required, but much appreciated! You can donate [here](http://cryto.net/~joepie91/donate.html).
### new ValidationError(message, [properties])
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.
__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".
* __properties:__*Optional.* An object of properties to attach to the new error object.
* __path:__ An array of 'path segment' strings that describes the location of the validation error.