version.js 757 B

123456789101112131415161718192021222324252627282930313233343536
  1. 'use strict';
  2. /*!
  3. * Module dependencies.
  4. */
  5. const MongooseError = require('./');
  6. /**
  7. * Version Error constructor.
  8. *
  9. * @inherits MongooseError
  10. * @api private
  11. */
  12. function VersionError(doc, currentVersion, modifiedPaths) {
  13. const modifiedPathsStr = modifiedPaths.join(', ');
  14. MongooseError.call(this, 'No matching document found for id "' + doc._id +
  15. '" version ' + currentVersion + ' modifiedPaths "' + modifiedPathsStr + '"');
  16. this.name = 'VersionError';
  17. this.version = currentVersion;
  18. this.modifiedPaths = modifiedPaths;
  19. }
  20. /*!
  21. * Inherits from MongooseError.
  22. */
  23. VersionError.prototype = Object.create(MongooseError.prototype);
  24. VersionError.prototype.constructor = MongooseError;
  25. /*!
  26. * exports
  27. */
  28. module.exports = VersionError;