convert a fieldExceptions element to a FieldError or FieldError array
548908
def as_field_error(node, secid):
        
        assert node.Name == 'fieldExceptions'
        if node.IsArray:
            return [XmlHelper.as_field_error(node.GetValue(_), secid) for _ in range(node.NumValues)]
        else:
            fld = XmlHelper.get_child_value(node, 'fieldId')
            info = node.GetElement('errorInfo')
            src = XmlHelper.get_child_value(info, 'source')
            code = XmlHelper.get_child_value(info, 'code')
            cat = XmlHelper.get_child_value(info, 'category')
            msg = XmlHelper.get_child_value(info, 'message')
            subcat = XmlHelper.get_child_value(info, 'subcategory')
            return FieldError(security=secid, field=fld, source=src, code=code, category=cat, message=msg,
                              subcategory=subcat)
795782
def _get_field_error_dict(self, field):
        ''''''
        return {
            'name': field.html_name,
            'id': 'id_{}'.format(field.html_name), # This may be a problem
            'errors': field.errors,
        }
681691
def to_array(self):
        
        array = super(PassportElementErrorDataField, self).to_array()
        array['source'] = u(self.source)  # py2: type unicode, py3: type str
        array['type'] = u(self.type)  # py2: type unicode, py3: type str
        array['field_name'] = u(self.field_name)  # py2: type unicode, py3: type str
        array['data_hash'] = u(self.data_hash)  # py2: type unicode, py3: type str
        array['message'] = u(self.message)  # py2: type unicode, py3: type str
        return array
1035445
def render_field_error(self, obj_id, obj, exception, request):
        
        if obj is None:
            msg = 'No match for ID={0}'.format(obj_id)
        else:
            msg = unicode(exception)
        return u'<p class="error">{0}</p>'.format(msg)
296870
function _dispatchFieldErrors({ node, callerId }, errorResult) {
    const isMultiNode = Array.isArray(node);
    const data = {};
    if (isMultiNode) {
        node.forEach((nd) => {
            data[nd] = (errorResult || {})[nd] || null;
        });
    } else {
        data[node] = errorResult;
    }

    const errorStatus = {
        name: 'error',
        isLoading: false
    };
    let newStatus = {};
    if (isMultiNode) {
        node.forEach((nd) => {
            newStatus[nd] = errorStatus;
        });
    } else {
        newStatus[node] = errorStatus;
    }
    dispatcher.handleServerAction({
        data,
        type: 'updateError',
        status: newStatus,
        callerId
    });
}
731491
public void addFieldError(String field, String errorInfo) {

        fieldError.put(field, errorInfo);
        message.put(FrontEndInterfaceConstant.FIELD_STRING, fieldError);
    }
1023274
function serializeError(err) {
  var o = {};

  Object.getOwnPropertyNames(err).forEach(function (k) {
    o[k] = err[k];
  });

  return _.omit(o, ['stack', 'type', 'arguments']);
}
672228
private static ReflectionException handleException(String fieldName, NoSuchFieldException e) {
        LOGGER.error("Couldn't find field " + fieldName, e);
        return new ReflectionException(e);
    }
1269006
function (preconditions) {
        var errorCodesList = {
            "500": ["InternalServerError"],
            "400": [
                "UnexpectedDefaultValue",
                "UnexpectedType",
                "MinLengthUnderachieved",
                "MaxLengthExceeded",
                "MinValueUnderachived",
                "MaxValueExceeded",
                "ValueNotAllowed",
                "PatternMismatch",
                "MissingRequiredParameter"],
            "429": ["RateLimitExceeded"],
        };
        for (var index in preconditions) {
            if (preconditions[index].conditions && preconditions[index].conditions.responses) {
                for (var code in preconditions[index].conditions.responses) {
                    if (errorCodesList[code]) {
                        if (_.isArray(preconditions[index].conditions.responses[code])) {
                            for (var ecode in preconditions[index].conditions.responses[code]) {
                                if (_.indexOf(errorCodesList[code], preconditions[index].conditions.responses[code][ecode]) == -1) {
                                    errorCodesList[code].push(preconditions[index].conditions.responses[code][ecode]);
                                }
                            }
                        }
                        else {
                            if (_.indexOf(errorCodesList[code], preconditions[index].conditions.responses[code]) == -1) {
                                errorCodesList[code].push(preconditions[index].conditions.responses[code]);
                            }
                        }
                    }
                    else {
                        if (_.isArray(preconditions[index].conditions.responses[code])) {
                            errorCodesList[code] = _.clone(preconditions[index].conditions.responses[code]);
                        }
                        else {
                            errorCodesList[code] = [_.clone(preconditions[index].conditions.responses[code])];
                        }
                    }
                }
            }
        }
        return errorCodesList;
    }
1226352
function FindExceptionInList(playerCards, dealerCard, overrides)
{
    // First create a sorted version of this list    
    var sortedHand = playerCards.slice(0).sort((a, b) => (a-b));
    var action = null;

    // Now you can compare
    for (var i = 0; i < overrides.length; i++)
    {
        if ((dealerCard == overrides[i].dealer) && (sortedHand.length == overrides[i].hand.length))
        {
            for (var card = 0; card < sortedHand.length; card++)
            {
                if (sortedHand[card] != overrides[i].hand[card])
                {
                    // Not a match
                    break;
                }
            }

            // If we got all the way through, it's a match!
            if (card == sortedHand.length)
            {
                // We did it!
                action = overrides[i].action;
                break;
            }
        }
    }

    return action;
 }
577380
function getExtraFields (cartoError) {
  var errorlist = _getErrorList(cartoError);
  var listedError = _getListedError(cartoError, errorlist);

  return {
    friendlyMessage: listedError.friendlyMessage,
    errorCode: listedError.errorCode
  };
}
1086038
def from_validation_exception(cls, exception, **kwargs):
        """"""
        errors = []

        def flatten(error, path=""):
            if isinstance(error, halogen.exceptions.ValidationError):
                if not path.endswith("/"):
                    path += "/"
                if error.attr is not None:
                    path += error.attr
                elif error.index is not None:
                    path += six.text_type(error.index)

                for e in error.errors:
                    flatten(e, path)
            else:
                message = error
                if isinstance(error, Exception):
                    try:
                        message = error.message
                    except AttributeError:
                        message = six.text_type(error)
                # TODO: i18n
                errors.append(Error(message=message, path=path))

        flatten(exception)
        message = kwargs.pop("message", "Validation error.")
        return cls(message=message, errors=sorted(errors, key=lambda error: error.path or ""), **kwargs)
373342
function generateNamedFieldExtractors(input) {
  var names = input.filter(function(matcher, index, array) {
    // has a name?
    return matcher.name;
  });
  // has duplicates?
  names.forEach(function(matcher, index, array) {
    var isDuplicate = array.slice(0, index).some(function(previousMatcher) {
      return previousMatcher.name == matcher.name;
    });
    if (isDuplicate) {
      throw new Error("duplicate named field '" + matcher.name + "'");
    }
  });
  return names;
}
312016
def format_error(self, field_name, message, index=None):
        
        pointer = ['/data']

        if index is not None:
            pointer.append(str(index))

        relationship = isinstance(
            self.declared_fields.get(field_name), BaseRelationship,
        )
        if relationship:
            pointer.append('relationships')
        elif field_name != 'id':
            # JSONAPI identifier is a special field that exists above the attribute object.
            pointer.append('attributes')

        pointer.append(self.inflect(field_name))

        if relationship:
            pointer.append('data')

        return {
            'detail': message,
            'source': {
                'pointer': '/'.join(pointer),
            },
        }
880896
public List<FieldError> getFieldErrors(final String path) {
        final String fullPath = buildFieldPath(path);
        
        return getFieldErrors().stream()
                .filter(e -> isMatchingFieldError(fullPath, e))
                .collect(Collectors.toList());
        
    }
199129
def to_raw(self, value, context=None):
        """"""
        if value is None:
            return None
        res = {}
        value = value.copy()
        errors = []
        for field in list(set(value) & set(self._fields)):
            schema = self._fields.get(field)
            name = schema.get_attr('name', field)
            try:
                res[name] = \
                    schema.to_raw(value.pop(field), context=context)
            except exceptions.ValidationErrors as ex:
                self._update_errors_by_exception(errors, ex, name)

        self._raise_exception_when_errors(errors, value)
        res.update(value)
        return res
172804
public List<ObjectError> getGlobalErrors() {
        return errors.stream()
                .filter(e -> !(e instanceof FieldError))
                .collect(Collectors.toList());
    }