Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

notFound.js 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. 'use strict';
  2. /*!
  3. * Module dependencies.
  4. */
  5. const MongooseError = require('./');
  6. const util = require('util');
  7. /*!
  8. * OverwriteModel Error constructor.
  9. *
  10. * @inherits MongooseError
  11. */
  12. function DocumentNotFoundError(filter) {
  13. let msg;
  14. const messages = MongooseError.messages;
  15. if (messages.DocumentNotFoundError != null) {
  16. msg = typeof messages.DocumentNotFoundError === 'function' ?
  17. messages.DocumentNotFoundError(filter) :
  18. messages.DocumentNotFoundError;
  19. } else {
  20. msg = 'No document found for query "' + util.inspect(filter) + '"';
  21. }
  22. MongooseError.call(this, msg);
  23. this.name = 'DocumentNotFoundError';
  24. if (Error.captureStackTrace) {
  25. Error.captureStackTrace(this);
  26. } else {
  27. this.stack = new Error().stack;
  28. }
  29. this.filter = filter;
  30. // Backwards compat
  31. this.query = filter;
  32. }
  33. /*!
  34. * Inherits from MongooseError.
  35. */
  36. DocumentNotFoundError.prototype = Object.create(MongooseError.prototype);
  37. DocumentNotFoundError.prototype.constructor = MongooseError;
  38. /*!
  39. * exports
  40. */
  41. module.exports = DocumentNotFoundError;