disconnected.js 941 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*!
  2. * Module dependencies.
  3. */
  4. 'use strict';
  5. const MongooseError = require('./');
  6. /**
  7. * The connection failed to reconnect and will never successfully reconnect to
  8. * MongoDB without manual intervention.
  9. *
  10. * @param {String} type
  11. * @param {String} value
  12. * @inherits MongooseError
  13. * @api private
  14. */
  15. function DisconnectedError(connectionString) {
  16. MongooseError.call(this, 'Ran out of retries trying to reconnect to "' +
  17. connectionString + '". Try setting `server.reconnectTries` and ' +
  18. '`server.reconnectInterval` to something higher.');
  19. this.name = 'DisconnectedError';
  20. if (Error.captureStackTrace) {
  21. Error.captureStackTrace(this);
  22. } else {
  23. this.stack = new Error().stack;
  24. }
  25. }
  26. /*!
  27. * Inherits from MongooseError.
  28. */
  29. DisconnectedError.prototype = Object.create(MongooseError.prototype);
  30. DisconnectedError.prototype.constructor = MongooseError;
  31. /*!
  32. * exports
  33. */
  34. module.exports = DisconnectedError;