From 839c1c177005cec397c714993e94541b2aa345aa Mon Sep 17 00:00:00 2001 From: Marcus Pohorely Date: Sun, 12 May 2019 13:42:54 +0200 Subject: [PATCH] feat: Added name to validation-error (#60) * 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 --- lib/validation-error.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/validation-error.js b/lib/validation-error.js index d759625..c073a63 100644 --- a/lib/validation-error.js +++ b/lib/validation-error.js @@ -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;