*
Creates an Validation Error object with a code, message and a field
@param {String} code
@param {String} message
@param {String} field
@returns {js.data.validator.Validator.Error}
@private
352194
function(code, message, field){
            return new Validator.Error({
                code: code,
                message: message,
                field: field
            });
        }
1082498
function defineError(code, message) {
    var ErrorClass = errors.helpers.generateClass(code);
    function ExportedError(err) {
        ErrorClass.call(this, message, err);
        return this;
    }
    util.inherits(ExportedError, ErrorClass);
    return ExportedError;
}
617657
function(code, err, message) {
		code = (code || isNaN(code)) ? code : 500;
		err = (err) ? err : '';
		message = (message) ? message : '';

		return {
			'code': code,
			'error': err,
			'message': message
		};
	}
1324499
function( e ) {
      var self = this, // stored this
          invalidFields = [];
      // Make invalidFields accessible
      this.getInvalidFields = function(){
        return invalidFields;
      }
      for ( var i = 0, _lengthFields = FIELDS.length; i < _lengthFields; i++ ) {
        // if field is disabled, do not check
        if ( FIELDS[ i ].disabled ) continue;
        var el = FIELDS[ i ], //current field
          errors = '', //current field's errors
          val = trim ( $( el ).val() ), //current field's value
          methods = el.getAttribute('data-validetta').split(','), //current field's control methods
          state; // Validation state
        // Create tmp
        this.tmp = {};
        // store el and val variables in tmp
        this.tmp = { el : el, val : val, parent : this.parents( el ) };
        // Start to check fields
        // Validator : Fields Control Object
        for ( var j = 0, _lengthMethods = methods.length; j < _lengthMethods; j++ ) {
          // Check Rule
          var rule = methods[ j ].match( RRULE ),
            method;
          // Does it have rule?
          if( rule !== null ) {
            // Does it have any argument ?
            if( typeof rule[2] !== 'undefined' ) this.tmp.arg = rule[2];
            // Set method name
            method = rule[1];
          } else { method = methods[ j ]; }
          // prevent empty validation if method is not required
          if ( val === '' && method !== 'required' && method !== 'equalTo' ) continue;
          // Is there a methot in Validator ?
          if( Validator.hasOwnProperty( method ) ) {
            // Validator returns error message if method invalid
            state = Validator[ method ]( self.tmp, self );
            if ( typeof state !== 'undefined' && state !== true ) {
              var _dataMsg = el.getAttribute( 'data-vd-message-' + method );
              if ( _dataMsg !== null ) state = _dataMsg;
              errors += state +'<br/>';
            }
          }
        }
        // Check the errors
        if( errors !== '' ) {
          invalidFields.push({
            field: el,
            errors: errors
          });
          // if parent element has valid class, remove and add error class
          this.addErrorClass( this.tmp.parent );
          // open error window
          this.window.open.call( this , el, errors );
        // Check remote validation
        } else if ( typeof this.tmp.remote !== 'undefined' ) {
          this.checkRemote( el, e );
        } else { // Nice, there are no error
          if( typeof state !== 'undefined' ) this.addValidClass( this.tmp.parent );
          else $( this.tmp.parent ).removeClass( this.options.errorClass +' '+ this.options.validClass );
          state = undefined; // Reset state variable
        }
      }
    }
1254281
function Validation(schema, custom) {
		Inspection.prototype.constructor.call(this, schema, _merge(Validation.custom, custom));
		var _error = [];

		this._basicFields = Object.keys(_validationAttribut);
		this._customFields = Object.keys(this._custom);
		this.origin = null;

		this.report = function (message, code, reason) {
			var newErr = {
				code: code || this.userCode || null,
				reason: reason || 'unknown',
				message: this.userError || message || 'is invalid',
				property: this.userAlias ? (this.userAlias + ' (' + this._dumpStack() + ')') : this._dumpStack()
			};
			_error.push(newErr);
			return this;
		};

		this.result = function () {
			return {
				error: _error,
				valid: _error.length === 0,
				format: function () {
					if (this.valid === true) {
						return 'Candidate is valid';
					}
					return this.error.map(function (i) {
						return 'Property ' + i.property + ': ' + i.message;
					}).join('\n');
				}
			};
		};
	}
230302
function ModelAPIError(code, message, errors) {
  var err;
  if (message instanceof Error) err = message;
  else err = new Error(message);
  err.__proto__ = ModelAPIError.prototype;
  Object.defineProperty(err, 'code', {
    enumerable: true,
    value: code,
    writeable: false
  });
  if (typeof message === 'string') {
    Object.defineProperty(err, 'message', {
      enumerable: true,
      value: message,
      writeable: false
    });
  }
  if (errors) {
    Object.defineProperty(err, 'errors', {
      enumerable: true,
      value: errors,
      writeable: false
    });
  }
  return err;
}
359316
function(field, length) {
    if (Array.isArray(field)) {
      return this.validateFieldsHelper(field, [length], this.validatesLengthOf)
    }

    return this.validates(field, function() {
      var valid = true
      if (this[field]) valid = this[field].length <= length
      if (!valid)
        this.errors.add(field, 'maximum length of ' + length + ' exceeded')
      return valid
    })
  }
160444
function createCheckEmail(fieldDefinition, fieldName) {
  const severity = propertyHelper.getSeverity(fieldDefinition);

  // return getIteratorFunction: function (fieldName, defaultValue, checkProperties, checkFunction, getErrorFunction,
  // 	getValueIfErrorFunction, getValueIfOkFunction) {

  let errorInfo = {
    severity: severity,
    errorCode: 'NOT_EMAIL'
  };

  return functionHelper.getParserCheck(errorInfo, getEmailIfValid, fieldName, undefined);

}
208045
protected void validateDate(String field, String errorKey, String errorMessage) {
		String value = controller.getPara(field);
		if (StrKit.isBlank(value)) {
			addError(errorKey, errorMessage);
			return ;
		}
		try {
			new SimpleDateFormat(getDatePattern()).parse(value.trim());	// Date temp = Date.valueOf(value); 为了兼容 64位 JDK
		}
		catch (Exception e) {
			addError(errorKey, errorMessage);
		}
	}
680211
function performValidation(field) {
        return function(rule, cb) {
            var valueToBeValidated = kontx.args.fields[field._id],
                validate = validator.get(rule);

            //Undefined values do not need to be validated unless the field is required
            if (rule.type === 'required' || !_.isUndefined(valueToBeValidated)) {
                if (_.isArray(valueToBeValidated)) {
                    q.all(
                        _.map(valueToBeValidated, function(value) {
                            return validate(value, rule.options);
                        })
                    )
                        .then(
                            function() {
                                cb();
                            },
                            function() {
                                cb(createError(400, validationTemplate({
                                    label: field.label
                                })));
                            }
                    );
                } else {
                    validate(valueToBeValidated, rule.options)
                        .then(
                            function() {
                                cb();
                            },
                            function() {
                                cb(createError(400, validationTemplate({
                                    label: field.label
                                })));
                            }
                    );
                }
            } else {
                cb();
            }
        };
    }
945321
function Exception(code, message) {
    Error.captureStackTrace(this, Exception);
    this.name = Exception.name;
    this.code = code;
    this.message = message;
}
770775
protected function addError($message, $code, array $arguments = [])
    {
        $this->result->addError(new ValidationError($message, $code, $arguments));
    }
606326
function (field, error) {

                if (field instanceof Object) {
                    this.$errors.set(field);
                } else {
                    this.$errors.set(field, error);
                }

                this.trigger('isValidChanged');
            }
965202
public void rejectValue(final String field, final Class<?> fieldType, final String[] errorCodes, 
            final Map<String, Object> messageVariables, final String defaultMessage) {
        
        String[] codes = new String[0];
        for(String errorCode : errorCodes) {
            codes = Utils.concat(codes, messageCodeGenerator.generateCodes(errorCode, getObjectName(), field, fieldType));
        }
        
        addError(new CsvFieldError(getObjectName(), field, false, codes, messageVariables, defaultMessage));
        
    }
1077952
function getErrorField (error) {
    // if field is nested the get nested field
    if (error.baseProperty) {
        // get field from base property
        var field = _.find(this.fields, field => field.property === error.baseProperty)
        // get sub field
        return getSubField(field, error.index, error.property)
    }
    // return field
    else {
        return _.find(this.fields, field => field.property === error.property)
    }
}
195460
public function addValidationError($field, $errorMessage)
    {
        $this->_isValid = false;
        $this->_validationErrors[$field] = $errorMessage;
    }
964969
public static void error(Object... message) {
        StringBuilder builder = new StringBuilder(APP_ERROR);
        for (Object object : message) {
            builder.append(object.toString());
        }
        errorStream.println(builder.toString());
    }