missingSchema.js 740 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*!
  2. * Module dependencies.
  3. */
  4. 'use strict';
  5. const MongooseError = require('./');
  6. /*!
  7. * MissingSchema Error constructor.
  8. *
  9. * @inherits MongooseError
  10. */
  11. function MissingSchemaError(name) {
  12. const msg = 'Schema hasn\'t been registered for model "' + name + '".\n'
  13. + 'Use mongoose.model(name, schema)';
  14. MongooseError.call(this, msg);
  15. this.name = 'MissingSchemaError';
  16. if (Error.captureStackTrace) {
  17. Error.captureStackTrace(this);
  18. } else {
  19. this.stack = new Error().stack;
  20. }
  21. }
  22. /*!
  23. * Inherits from MongooseError.
  24. */
  25. MissingSchemaError.prototype = Object.create(MongooseError.prototype);
  26. MissingSchemaError.prototype.constructor = MongooseError;
  27. /*!
  28. * exports
  29. */
  30. module.exports = MissingSchemaError;