LISTOFERRORS

ZCUSTOMERROR~ LISTOFERRORS

List of errors (should be loop/parsed on LISTOFERRORS.errors like an array). Can be usefull with custom format.

Validate failed because wrong value(s):
  - root: Custom format "children" tried to validate something and failed:
    1) germany:
      - name: must be of type String: value was 1
    2) italy:
      - subregion: must be of type String: value was 2

Constructor

new LISTOFERRORS(errors)

Source:
Example
blueconfig.addFormat({ // Allow to do: config.*.name, by example : config.app1.name, config.app2.name
  name: 'children',
  validate: function(children, schema, fullname) {
    Object.keys(children).forEach((keyname) => {
      try {
        const conf = blueconfig(schema.children).merge(children[keyname]).validate();
        this.set(keyname, conf.getProperties());
      } catch (err) { errors.push(err); }
    });

    if (errors.length !== 0) { throw new LISTOFERRORS(errors) }
  }
});
Parameters:
errors Array.<BLUECONFIG_ERROR>

List of errors

Extends

  • BLUECONFIG_ERROR