Files
DemoApp/node_modules/mongoose/lib/errors/validator.js

46 lines
756 B
JavaScript

/*!
* Module dependencies.
*/
var MongooseError = require('../error');
/**
* Schema validator error
*
* @param {String} path
* @param {String} msg
* @inherits MongooseError
* @api private
*/
function ValidatorError (path, type) {
var msg = type
? '"' + type + '" '
: '';
MongooseError.call(this, 'Validator ' + msg + 'failed for path ' + path);
Error.captureStackTrace(this, arguments.callee);
this.name = 'ValidatorError';
this.path = path;
this.type = type;
};
/*!
* toString helper
*/
ValidatorError.prototype.toString = function () {
return this.message;
}
/*!
* Inherits from MongooseError
*/
ValidatorError.prototype.__proto__ = MongooseError.prototype;
/*!
* exports
*/
module.exports = ValidatorError;