arnaucube
arnaucube/thoughtsPublic Self-hosted repository
thoughts/node_modules/mongoose/lib/errors/cast.js
node_modules/mongoose/lib/errors/cast.jsRaw
 1/*!
 2 * Module dependencies.
 3 */
 4
 5var MongooseError = require('../error');
 6
 7/**
 8 * Casting Error constructor.
 9 *
10 * @param {String} type
11 * @param {String} value
12 * @inherits MongooseError
13 * @api private
14 */
15
16function CastError (type, value, path) {
17  MongooseError.call(this, 'Cast to ' + type + ' failed for value "' + value + '" at path "' + path + '"');
18  Error.captureStackTrace(this, arguments.callee);
19  this.name = 'CastError';
20  this.type = type;
21  this.value = value;
22  this.path = path;
23};
24
25/*!
26 * Inherits from MongooseError.
27 */
28
29CastError.prototype.__proto__ = MongooseError.prototype;
30
31/*!
32 * exports
33 */
34
35module.exports = CastError;