From d4c927d24f68052f29e4f019ae05b27b63cadf97 Mon Sep 17 00:00:00 2001 From: KhealthDavid <68499011+KhealthDavid@users.noreply.github.com> Date: Sun, 2 May 2021 12:34:11 +0300 Subject: [PATCH] Fixed issue #47 Based on https://github.com/iMicknl/python-tahoma-api/pull/36 --- python_graphql_client/graphql_client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python_graphql_client/graphql_client.py b/python_graphql_client/graphql_client.py index 1d3d104..f2ea7a9 100644 --- a/python_graphql_client/graphql_client.py +++ b/python_graphql_client/graphql_client.py @@ -72,7 +72,13 @@ async def execute_async( json=request_body, headers={**self.headers, **headers}, ) as response: - return await response.json() + try: + return await response.json() + except JSONDecodeError as error: + result = await response.text() + raise Exception( + f"Unknown error while requesting {response.url}. {response.status} - {result}" + ) from error async def subscribe( self,