overwriteModel.js 674 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*!
  2. * Module dependencies.
  3. */
  4. 'use strict';
  5. const MongooseError = require('./');
  6. /*!
  7. * OverwriteModel Error constructor.
  8. *
  9. * @inherits MongooseError
  10. */
  11. function OverwriteModelError(name) {
  12. MongooseError.call(this, 'Cannot overwrite `' + name + '` model once compiled.');
  13. this.name = 'OverwriteModelError';
  14. if (Error.captureStackTrace) {
  15. Error.captureStackTrace(this);
  16. } else {
  17. this.stack = new Error().stack;
  18. }
  19. }
  20. /*!
  21. * Inherits from MongooseError.
  22. */
  23. OverwriteModelError.prototype = Object.create(MongooseError.prototype);
  24. OverwriteModelError.prototype.constructor = MongooseError;
  25. /*!
  26. * exports
  27. */
  28. module.exports = OverwriteModelError;