objectParameter.js 668 B

123456789101112131415161718192021222324252627282930
  1. /*!
  2. * Module dependencies.
  3. */
  4. 'use strict';
  5. const MongooseError = require('./');
  6. class ObjectParameterError extends MongooseError {
  7. /**
  8. * Constructor for errors that happen when a parameter that's expected to be
  9. * an object isn't an object
  10. *
  11. * @param {Any} value
  12. * @param {String} paramName
  13. * @param {String} fnName
  14. * @api private
  15. */
  16. constructor(value, paramName, fnName) {
  17. super('Parameter "' + paramName + '" to ' + fnName +
  18. '() must be an object, got ' + value.toString());
  19. }
  20. }
  21. Object.defineProperty(ObjectParameterError.prototype, 'name', {
  22. value: 'ObjectParameterError'
  23. });
  24. module.exports = ObjectParameterError;