예제 #1
0
def process_react_exception(exc, match, mapping):
    error_id, qs = match.groups()
    msg_format = mapping.get(error_id)
    if msg_format is None:
        return False

    arg_count = count_sprintf_parameters(msg_format)
    args = []
    for k, v in parse_qsl(qs, keep_blank_values=True):
        if k == 'args[]':
            args.append(v)

    # Due to truncated error messages we sometimes might not be able to
    # get all arguments.  In that case we fill up missing parameters for
    # the format string with <redacted>.
    args = tuple(args + ['<redacted>'] * (arg_count - len(args)))[:arg_count]
    exc['value'] = msg_format % args

    return True
예제 #2
0
def process_react_exception(exc, match, mapping):
    error_id, qs = match.groups()
    msg_format = mapping.get(error_id)
    if msg_format is None:
        return False

    arg_count = count_sprintf_parameters(msg_format)
    args = []
    for k, v in parse_qsl(qs, keep_blank_values=True):
        if k == 'args[]':
            args.append(v.decode('utf-8', 'replace'))

    # Due to truncated error messages we sometimes might not be able to
    # get all arguments.  In that case we fill up missing parameters for
    # the format string with <redacted>.
    args = tuple(args + [u'<redacted>'] * (arg_count - len(args)))[:arg_count]
    exc['value'] = msg_format % args

    return True
예제 #3
0
def process_react_exception(exc, match, mapping):
    error_id, qs = match.groups()
    msg_format = mapping.get(error_id)
    if msg_format is None:
        return False

    arg_count = count_sprintf_parameters(msg_format)
    args = []
    for k, v in parse_qsl(qs, keep_blank_values=True):
        if k == "args[]":
            if isinstance(v, six.binary_type):
                v = v.decode("utf-8", "replace")
            args.append(v)

    # Due to truncated error messages we sometimes might not be able to
    # get all arguments.  In that case we fill up missing parameters for
    # the format string with <redacted>.
    args = tuple(args + [u"<redacted>"] * (arg_count - len(args)))[:arg_count]
    exc["value"] = msg_format % args

    return True