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
733 B

  1. /*!
  2. * Module dependencies.
  3. */
  4. var MongooseError = require('../error.js');
  5. /**
  6. * Strict mode error constructor
  7. *
  8. * @param {String} type
  9. * @param {String} value
  10. * @inherits MongooseError
  11. * @api private
  12. */
  13. function StrictModeError(path) {
  14. MongooseError.call(this, 'Field `' + path + '` is not in schema and strict ' +
  15. 'mode is set to throw.');
  16. if (Error.captureStackTrace) {
  17. Error.captureStackTrace(this);
  18. } else {
  19. this.stack = new Error().stack;
  20. }
  21. this.name = 'StrictModeError';
  22. this.path = path;
  23. }
  24. /*!
  25. * Inherits from MongooseError.
  26. */
  27. StrictModeError.prototype = Object.create(MongooseError.prototype);
  28. StrictModeError.prototype.constructor = MongooseError;
  29. module.exports = StrictModeError;