Skip to content

Handle ContentTypeError during parsing of response #38

Description

@jepebe
{
    "args": [],
    "exc_info": None,
    "exc_text": None,
    "levelno": 40,
    "local_time_zone": "UTC",
    "log_level_name": "ERROR",
    "log_source": "server",
    "log_timestamp_local": "2025-03-19T10:33:37.520509+00:00",
    "log_timestamp_utc": "2025-03-19T10:33:37.520509+00:00",
    "message": "Unexpected exception: 403, message='Attempt to decode JSON with unexpected mimetype: text/html', url='...'",
    "metric": "UNEXPECTED_ERROR",
    "msecs": 520.0,
    "name": "logger",
    "process": 1,
    "processName": "MainProcess",
    "relativeCreated": 37580319.009653,
    "stack_info": None,
    "taskName": "Task-2",
    "thread": 127606266616704,
    "threadName": "MainThread",
    "tick_counter": 2447,
    "timestamp_local": 1742380417.5205095,
    "traceback": [
        "Traceback (most recent call last):\n",
        '  File "/usr/local/lib/python3.13/site-packages/toadr3/events.py", line 112, in get_events\n    json_response = await response.json()  # JSON should be of type Problem schema\n                    ^^^^^^^^^^^^^^^^^^^^^\n',
        '  File "/usr/local/lib/python3.13/site-packages/aiohttp/client_reqrep.py", line 1281, in json\n    raise ContentTypeError(\n    ...<7 lines>...\n    )\n',
        "aiohttp.client_exceptions.ContentTypeError: 403, message='Attempt to decode JSON with unexpected mimetype: text/html', url='...'\n",
    ],
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions