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.

messages.js 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * The default built-in validator error messages. These may be customized.
  3. *
  4. * // customize within each schema or globally like so
  5. * var mongoose = require('mongoose');
  6. * mongoose.Error.messages.String.enum = "Your custom message for {PATH}.";
  7. *
  8. * As you might have noticed, error messages support basic templating
  9. *
  10. * - `{PATH}` is replaced with the invalid document path
  11. * - `{VALUE}` is replaced with the invalid value
  12. * - `{TYPE}` is replaced with the validator type such as "regexp", "min", or "user defined"
  13. * - `{MIN}` is replaced with the declared min value for the Number.min validator
  14. * - `{MAX}` is replaced with the declared max value for the Number.max validator
  15. *
  16. * Click the "show code" link below to see all defaults.
  17. *
  18. * @static messages
  19. * @receiver MongooseError
  20. * @api public
  21. */
  22. 'use strict';
  23. const msg = module.exports = exports = {};
  24. msg.DocumentNotFoundError = null;
  25. msg.general = {};
  26. msg.general.default = 'Validator failed for path `{PATH}` with value `{VALUE}`';
  27. msg.general.required = 'Path `{PATH}` is required.';
  28. msg.Number = {};
  29. msg.Number.min = 'Path `{PATH}` ({VALUE}) is less than minimum allowed value ({MIN}).';
  30. msg.Number.max = 'Path `{PATH}` ({VALUE}) is more than maximum allowed value ({MAX}).';
  31. msg.Date = {};
  32. msg.Date.min = 'Path `{PATH}` ({VALUE}) is before minimum allowed value ({MIN}).';
  33. msg.Date.max = 'Path `{PATH}` ({VALUE}) is after maximum allowed value ({MAX}).';
  34. msg.String = {};
  35. msg.String.enum = '`{VALUE}` is not a valid enum value for path `{PATH}`.';
  36. msg.String.match = 'Path `{PATH}` is invalid ({VALUE}).';
  37. msg.String.minlength = 'Path `{PATH}` (`{VALUE}`) is shorter than the minimum allowed length ({MINLENGTH}).';
  38. msg.String.maxlength = 'Path `{PATH}` (`{VALUE}`) is longer than the maximum allowed length ({MAXLENGTH}).';