aiohttp exception without an exception message

I am running a simple HTTP get to get information from an API. However when I run this request every once in a while I get an exception, with no exception error. How would I go about debugging this more… I am at a loss right now.

Note: This is running at scale million+ numbers are be looked up by 200 asyncio.create_task()'s that are running this function. It happens if I am running 1 asyncio.create_task() or 200 asyncio.create_task().

async def query(number):
    params = [('apikey', apikey), ('number', number)]

        async with aiohttp.ClientSession() as session:
            async with session.get(apiurl, params=params, timeout=5) as resp:
                response = await resp.json()
                status = resp.status
    except Exception as e:
        print(f'query({number}): API Request Failure: {e}')
        status = None
        response = None
    return {'status': status, 'response': response}

Exception Result

query(1234567890): API Request Failure:

Depending on your Python version, you may be catching the asyncio.CancelledError exception by mistake. It has no exception value. In fact a lot of exceptions have no value, just type. I suggest you replace {e} with {e!r} to get a repr() of the exception printed.

Awesome thanks for you help I will check this out. Never knew about the e!r

Running Python 3.8.5 on Ubuntu20.04