Skip to content

Handle 404 more gracefully / explicitly #415

Closed
@mausch

Description

@mausch

Hi and thanks for this project!

Describe the bug
When getting a 404 I get an unrelated stack trace as the code doesn't seem to handle the response status:

Traceback (most recent call last):
  File "/home/mauricio/prg/elevate/elevate-chatbot/.mamba/envs/chatbot/lib/python3.10/site-packages/gql/client.py", line 285, in execute_async
    return await session.execute(
  File "/home/mauricio/prg/elevate/elevate-chatbot/.mamba/envs/chatbot/lib/python3.10/site-packages/gql/client.py", line 1220, in execute
    result = await self._execute(
  File "/home/mauricio/prg/elevate/elevate-chatbot/.mamba/envs/chatbot/lib/python3.10/site-packages/gql/client.py", line 1126, in _execute
    result = await asyncio.wait_for(
  File "/home/mauricio/prg/elevate/elevate-chatbot/.mamba/envs/chatbot/lib/python3.10/asyncio/tasks.py", line 447, in wait_for
    return fut.result()
  File "/home/mauricio/prg/elevate/elevate-chatbot/.mamba/envs/chatbot/lib/python3.10/site-packages/gql/transport/aiohttp.py", line 325, in execute
    if "errors" not in result and "data" not in result:
TypeError: argument of type 'NoneType' is not iterable

To Reproduce
Steps to reproduce the behavior:
Point any gql query to a server that responds with 404.

Expected behavior
An explicit exception mentioning that the status was 404.

System info (please complete the following information):

  • OS: Linux
  • Python version: 3.10
  • gql version: 3.4.1
  • graphql-core version: 3.2.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions