We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cec9dda commit d9163f5Copy full SHA for d9163f5
lib/error/validation.js
@@ -17,16 +17,15 @@ const util = require('util');
17
18
function ValidationError(instance) {
19
this.errors = {};
20
- this.name = 'ValidationError';
21
this._message = '';
22
+ MongooseError.call(this, this._message);
23
if (instance && instance.constructor.name === 'model') {
24
this._message = instance.constructor.modelName + ' validation failed';
25
} else {
26
this._message = 'Validation failed';
27
}
28
-
29
- MongooseError.call(this, this._message);
+ this.name = 'ValidationError';
30
31
if (Error.captureStackTrace) {
32
Error.captureStackTrace(this);
0 commit comments