You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
649 B

  1. /*!
  2. * Module dependencies.
  3. */
  4. var MongooseError = require('../error');
  5. /**
  6. * Casting Error constructor.
  7. *
  8. * @param {String} type
  9. * @param {String} value
  10. * @inherits MongooseError
  11. * @api private
  12. */
  13. function CastError (type, value, path) {
  14. MongooseError.call(this, 'Cast to ' + type + ' failed for value "' + value + '" at path "' + path + '"');
  15. Error.captureStackTrace(this, arguments.callee);
  16. this.name = 'CastError';
  17. this.type = type;
  18. this.value = value;
  19. this.path = path;
  20. };
  21. /*!
  22. * Inherits from MongooseError.
  23. */
  24. CastError.prototype.__proto__ = MongooseError.prototype;
  25. /*!
  26. * exports
  27. */
  28. module.exports = CastError;