File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -17,20 +17,23 @@ const util = require('util');
17
17
18
18
function ValidationError ( instance ) {
19
19
this . errors = { } ;
20
+ this . name = 'ValidationError' ;
20
21
this . _message = '' ;
22
+
21
23
if ( instance && instance . constructor . name === 'model' ) {
22
24
this . _message = instance . constructor . modelName + ' validation failed' ;
23
- MongooseError . call ( this , this . _message ) ;
24
25
} else {
25
26
this . _message = 'Validation failed' ;
26
- MongooseError . call ( this , this . _message ) ;
27
27
}
28
- this . name = 'ValidationError' ;
28
+
29
+ MongooseError . call ( this , this . _message ) ;
30
+
29
31
if ( Error . captureStackTrace ) {
30
32
Error . captureStackTrace ( this ) ;
31
33
} else {
32
34
this . stack = new Error ( ) . stack ;
33
35
}
36
+
34
37
if ( instance ) {
35
38
instance . errors = this . errors ;
36
39
}
You can’t perform that action at this time.
0 commit comments