Skip to content

Commit

Permalink
feat: Added name to validation-error (#60)
Browse files Browse the repository at this point in the history
* Added name to validation-error

Some other express middleware is using error names to be able to discovered, just for the sake of having everything i would add this.

You can then check instead of `err instanceof validate.ValidationError`  with `err.name === 'ValidationError'`

* Fixed missing semicolon
  • Loading branch information
derpoho authored and isaachinman committed May 12, 2019
1 parent c4dde4a commit 839c1c1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/validation-error.js
Expand Up @@ -3,6 +3,7 @@ var map = require('lodash/map');
var flatten = require('lodash/flatten');

function ValidationError (errors, options) {
this.name = 'ValidationError';
this.message = 'validation error';
this.errors = errors;
this.flatten = options.flatten;
Expand Down

0 comments on commit 839c1c1

Please sign in to comment.