version.js 771 B

123456789101112131415161718192021222324252627282930313233343536
  1. 'use strict';
  2. /*!
  3. * Module dependencies.
  4. */
  5. const MongooseError = require('./');
  6. class VersionError extends MongooseError {
  7. /**
  8. * Version Error constructor.
  9. *
  10. * @param {Document} doc
  11. * @param {Number} currentVersion
  12. * @param {Array<String>} modifiedPaths
  13. * @api private
  14. */
  15. constructor(doc, currentVersion, modifiedPaths) {
  16. const modifiedPathsStr = modifiedPaths.join(', ');
  17. super('No matching document found for id "' + doc._id +
  18. '" version ' + currentVersion + ' modifiedPaths "' + modifiedPathsStr + '"');
  19. this.version = currentVersion;
  20. this.modifiedPaths = modifiedPaths;
  21. }
  22. }
  23. Object.defineProperty(VersionError.prototype, 'name', {
  24. value: 'VersionError'
  25. });
  26. /*!
  27. * exports
  28. */
  29. module.exports = VersionError;