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

Method addError

lib/error/validation.js:53–65  ·  view source on GitHub ↗

* add message * @param {string} path * @param {string|Error} error * @api private

(path, error)

Source from the content-addressed store, hash-verified

51 * @api private
52 */
53 addError(path, error) {
54 if (error instanceof ValidationError) {
55 const { errors } = error;
56 for (const errorPath of Object.keys(errors)) {
57 this.addError(`${path}.${errorPath}`, errors[errorPath]);
58 }
59
60 return;
61 }
62
63 this.errors[path] = error;
64 this.message = this._message + ': ' + combinePathErrors(this);
65 }
66}
67
68

Callers 6

model.jsFile · 0.45
mongoose.jsFile · 0.45
query.jsFile · 0.45
document.jsFile · 0.45
_appendErrorFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected