invalidSchemaOption.js 592 B

1234567891011121314151617181920212223242526272829303132
  1. /*!
  2. * Module dependencies.
  3. */
  4. 'use strict';
  5. const MongooseError = require('./mongooseError');
  6. /**
  7. * InvalidSchemaOption Error constructor.
  8. * @param {String} name
  9. * @api private
  10. */
  11. class InvalidSchemaOptionError extends MongooseError {
  12. constructor(name, option) {
  13. const msg = `Cannot create use schema for property "${name}" because the schema has the ${option} option enabled.`;
  14. super(msg);
  15. }
  16. }
  17. Object.defineProperty(InvalidSchemaOptionError.prototype, 'name', {
  18. value: 'InvalidSchemaOptionError'
  19. });
  20. /*!
  21. * exports
  22. */
  23. module.exports = InvalidSchemaOptionError;