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

Method constructor

lib/error/validation.js:20–36  ·  view source on GitHub ↗

* Document Validation Error * * @api private * @param {Document} [instance] * @inherits MongooseError

(instance)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected