mirror of
https://github.com/bodyrep/DemoApp.git
synced 2026-01-26 07:01:38 +00:00
migrating repo to Bodyrep org
This commit is contained in:
43
node_modules/mongoose/lib/errors/validation.js
generated
vendored
Normal file
43
node_modules/mongoose/lib/errors/validation.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
/*!
|
||||
* Module requirements
|
||||
*/
|
||||
|
||||
var MongooseError = require('../error')
|
||||
|
||||
/**
|
||||
* Document Validation Error
|
||||
*
|
||||
* @api private
|
||||
* @param {Document} instance
|
||||
* @inherits MongooseError
|
||||
*/
|
||||
|
||||
function ValidationError (instance) {
|
||||
MongooseError.call(this, "Validation failed");
|
||||
Error.captureStackTrace(this, arguments.callee);
|
||||
this.name = 'ValidationError';
|
||||
this.errors = instance.errors = {};
|
||||
};
|
||||
|
||||
/**
|
||||
* Console.log helper
|
||||
*/
|
||||
|
||||
ValidationError.prototype.toString = function () {
|
||||
return this.name + ': ' + Object.keys(this.errors).map(function (key) {
|
||||
return String(this.errors[key]);
|
||||
}, this).join(', ');
|
||||
};
|
||||
|
||||
/*!
|
||||
* Inherits from MongooseError.
|
||||
*/
|
||||
|
||||
ValidationError.prototype.__proto__ = MongooseError.prototype;
|
||||
|
||||
/*!
|
||||
* Module exports
|
||||
*/
|
||||
|
||||
module.exports = exports = ValidationError;
|
||||
Reference in New Issue
Block a user