MCPcopy Create free account
hub / github.com/Automattic/mongoose / constructor

Method constructor

lib/error/validation.js:22–38  ·  view source on GitHub ↗
(instance)

Source from the content-addressed store, hash-verified

20class ValidationError extends MongooseError {
21
22 constructor(instance) {
23 let _message;
24 if (getConstructorName(instance) === 'model') {
25 _message = instance.constructor.modelName + ' validation failed';
26 } else {
27 _message = 'Validation failed';
28 }
29
30 super(_message);
31
32 this.errors = {};
33 this._message = _message;
34
35 if (instance) {
36 instance.$errors = this.errors;
37 }
38 }
39
40 /**
41 * Console.log helper

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected