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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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(query) {
  13. let msg;
  14. const messages = MongooseError.messages;
  15. if (messages.DocumentNotFoundError != null) {
  16. msg = typeof messages.DocumentNotFoundError === 'function' ?
  17. messages.DocumentNotFoundError(query) :
  18. messages.DocumentNotFoundError;
  19. } else {
  20. msg = 'No document found for query "' + util.inspect(query) + '"';
  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.query = query;
  30. }
  31. /*!
  32. * Inherits from MongooseError.
  33. */
  34. DocumentNotFoundError.prototype = Object.create(MongooseError.prototype);
  35. DocumentNotFoundError.prototype.constructor = MongooseError;
  36. /*!
  37. * exports
  38. */
  39. module.exports = DocumentNotFoundError;