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