We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 13ae085 + d9163f5 commit e6285eaCopy full SHA for e6285ea
lib/error/validation.js
@@ -18,19 +18,21 @@ const util = require('util');
18
function ValidationError(instance) {
19
this.errors = {};
20
this._message = '';
21
+
22
+ MongooseError.call(this, this._message);
23
if (instance && instance.constructor.name === 'model') {
24
this._message = instance.constructor.modelName + ' validation failed';
- MongooseError.call(this, this._message);
25
} else {
26
this._message = 'Validation failed';
27
}
28
this.name = 'ValidationError';
29
30
if (Error.captureStackTrace) {
31
Error.captureStackTrace(this);
32
33
this.stack = new Error().stack;
34
35
36
if (instance) {
37
instance.errors = this.errors;
38
0 commit comments