strictPopulate.js 645 B

12345678910111213141516171819202122232425262728293031
  1. /*!
  2. * Module dependencies.
  3. */
  4. 'use strict';
  5. const MongooseError = require('./mongooseError');
  6. /**
  7. * Strict mode error constructor
  8. *
  9. * @param {String} path
  10. * @param {String} [msg]
  11. * @inherits MongooseError
  12. * @api private
  13. */
  14. class StrictPopulateError extends MongooseError {
  15. constructor(path, msg) {
  16. msg = msg || 'Cannot populate path `' + path + '` because it is not in your schema. ' + 'Set the `strictPopulate` option to false to override.';
  17. super(msg);
  18. this.path = path;
  19. }
  20. }
  21. Object.defineProperty(StrictPopulateError.prototype, 'name', {
  22. value: 'StrictPopulateError'
  23. });
  24. module.exports = StrictPopulateError;