* Document Validation Error * * @api private * @param {Document} [instance] * @inherits MongooseError
(instance)
| 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 |
nothing calls this directly
no outgoing calls
no test coverage detected