Deeply merge two error messages.

    The format of ``errors1`` and ``errors2`` matches the ``message``
    parameter of :exc:`marshmallow.exceptions.ValidationError`.
493177
def merge_errors(errors1, errors2):
    
    if not errors1:
        return errors2
    if not errors2:
        return errors1
    if isinstance(errors1, list):
        if isinstance(errors2, list):
            return errors1 + errors2
        if isinstance(errors2, dict):
            return dict(
                errors2,
                **{SCHEMA: merge_errors(errors1, errors2.get(SCHEMA))}
            )
        return errors1 + [errors2]
    if isinstance(errors1, dict):
        if isinstance(errors2, list):
            return dict(
                errors1,
                **{SCHEMA: merge_errors(errors1.get(SCHEMA), errors2)}
            )
        if isinstance(errors2, dict):
            errors = dict(errors1)
            for key, val in iteritems(errors2):
                if key in errors:
                    errors[key] = merge_errors(errors[key], val)
                else:
                    errors[key] = val
            return errors
        return dict(
            errors1,
            **{SCHEMA: merge_errors(errors1.get(SCHEMA), errors2)}
        )
    if isinstance(errors2, list):
        return [errors1] + errors2 if errors2 else errors1
    if isinstance(errors2, dict):
        return dict(
            errors2,
            **{SCHEMA: merge_errors(errors1, errors2.get(SCHEMA))}
        )
    return [errors1, errors2]
304681
public void error(Object format,Object... msg) {
		if (logger.isErrorEnabled()) {
			// check if the first message contains variables variables
			if (format.toString().contains("{")) {
				logger.error(format.toString(), msg);
			} else {
				logger.error(format.toString().concat(" ").concat(JKStringUtil.concat(msg)));
			}
		}
	}
2269
def replace_default_error_messages():
    
    forms.Field.default_error_messages['required'] = _('This field is required')
    forms.CharField.default_error_messages['min_length'] = _('You’ve entered too few characters')
    forms.CharField.default_error_messages['max_length'] = _('You’ve entered too many characters')
    forms.IntegerField.default_error_messages['invalid'] = _('Enter a whole number')
    forms.FloatField.default_error_messages['invalid'] = _('Enter a number')
    forms.DecimalField.default_error_messages['invalid'] = _('Enter a number')
    forms.DateField.default_error_messages['invalid'] = _('Enter a valid date')
    forms.TimeField.default_error_messages['invalid'] = _('Enter a valid time')
    forms.DateTimeField.default_error_messages['invalid'] = _('Enter a valid date and time')
    forms.FileField.default_error_messages.update({
        'invalid': _('No file was submitted'),
        'missing': _('No file was submitted'),
        'empty': _('The submitted file is empty'),
    })
    forms.SplitDateTimeField.default_error_messages['invalid_date'] = _('Enter a valid date')
    forms.SplitDateTimeField.default_error_messages['invalid_time'] = _('Enter a valid time')
    validators.EmailValidator.message = _('Enter a valid email address')
396916
def error_message_and_exit(message, error_result):
    """"""
    if message:
        error_message(message)
    puts(json.dumps(error_result, indent=2))
    sys.exit(1)
1279909
protected void validateEqualField(String field_1, String field_2, String errorKey, String errorMessage) {
		String value_1 = controller.getPara(field_1);
		String value_2 = controller.getPara(field_2);
		if (value_1 == null || value_2 == null || (! value_1.equals(value_2))) {
			addError(errorKey, errorMessage);
		}
	}
134589
public void error(Marker marker, String format, Object arg1, Object arg2) {
        if (!logger.isErrorEnabled(marker))
            return;
        if (instanceofLAL) {
            String formattedMessage = MessageFormatter.format(format, arg1, arg2).getMessage();
            ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.ERROR_INT, formattedMessage, new Object[] { arg1, arg2 }, null);
        } else {
            logger.error(marker, format, arg1, arg2);
        }
    }
440376
def expected_error_messages(*error_messages):
    
    def wrapper(func):
        setattr(func, EXPECTED_ERROR_MESSAGES, error_messages)
        return func
    return wrapper
480393
protected String error2message(IApiError err) {
		if (err != null) {
			StringBuilder sb = new StringBuilder(err.toString());
			if (Str.STR.notNullOrEmpty(err.param())) {
				sb.append(" (").append(err.param()).append(")");
			}
			return sb.toString();
		}
		return new GenericApiError().toString();
	}
1164533
function formatError(err, options) {
    options = options || {};
    var name = err.name || err.constructor.name;
    var str = util.format('%s: %s\n', name, err.message);
    if (err.buffer && err.buffer.hexdump) {
        str += err.buffer.hexdump({
            colored: options.color,
            boldStart: false,
            highlight: options.color ? errorHighlighter(err, options) : null
        });
    } else if (Buffer.isBuffer(err.buffer)) {
        if (options.color) {
            str += formatBufferColored(err, options);
        } else {
            str += formatBufferUncolored(err, options);
        }
    }
    return str;
}
648657
function LightAssertionError(options) {
  merge(this, options);

  if (!options.message) {
    Object.defineProperty(this, "message", {
      get: function() {
        if (!this._message) {
          this._message = this.generateMessage();
          this.generatedMessage = true;
        }
        return this._message;
      }
    });
  }
}
225709
public static String mergeContent(String one, String two) throws Exception {
        return mergeContent(generateAst(one), generateAst(two));
    }
135492
function multipleErrors(errors) {
  var messages = errors.map(function(e) { return e.message; });
  return createError(
      ['Errors:'].concat(messages).join('\n- '),
      errors[0].interval);
}
1034357
def error(self, text):
		
		self.logger.error("{}{}".format(self.message_prefix, text))
1292524
function ObsessedError(message, errors) {
  Error.captureStackTrace(this, ObsessedError);
  this.message = this.combine(message, errors);
}
1328201
protected void validateEqualString(String s1, String s2, String errorKey, String errorMessage) {
		if (s1 == null || s2 == null || (! s1.equals(s2))) {
			addError(errorKey, errorMessage);
		}
	}
1131915
protected <V extends ATSecDBValidator> Set<ATError> createError(V validator, String key, String suffix, String defaultMessagePrefix, Object... arguments ) {
		Set<ATError> errors = new HashSet<>(1);
		if (null != validator) {
			errors.add(new ATError(key, 
					validator.getMessageWithSuffix(suffix, arguments, defaultMessagePrefix + StringUtils.join(arguments, ','))));
		} else if (null != messageSource) {
			errors.add(new ATError(key, 
					messageSource.getMessage(key, null, defaultMessagePrefix, LocaleContextHolder.getLocale())));
		} else {
			errors.add(new ATError(key, defaultMessagePrefix));
		}
		return errors;
	}
717664
def _flatten_marshmallow_errors(errors):
    """"""
    res = []
    for field, error in errors.items():
        if isinstance(error, list):
            res.append(
                dict(field=field, message=' '.join([str(x) for x in error])))
        elif isinstance(error, dict):
            res.extend(_flatten_marshmallow_errors(error))
    return res