diff --git a/src/firebolt/async_db/cursor.py b/src/firebolt/async_db/cursor.py index 890e71674a7..783cc931364 100644 --- a/src/firebolt/async_db/cursor.py +++ b/src/firebolt/async_db/cursor.py @@ -133,6 +133,15 @@ async def _raise_if_error(self, resp: Response) -> None: f"Firebolt engine {self.connection.engine_url} " "needs to be running to run queries against it." ) + try: + if ( + codes.is_error(resp.status_code) + and "Content-Length" in resp.headers + and int(resp.headers["Content-Length"]) > 0 + ): + logger.debug(f"Something went wrong: {resp.read().decode('utf-8')}") + except Exception: + pass resp.raise_for_status() async def _api_request( diff --git a/src/firebolt/db/cursor.py b/src/firebolt/db/cursor.py index 69c84a81115..8790fdef8e8 100644 --- a/src/firebolt/db/cursor.py +++ b/src/firebolt/db/cursor.py @@ -101,6 +101,12 @@ def _raise_if_error(self, resp: Response) -> None: f"Firebolt engine {self.connection.engine_url} " "needs to be running to run queries against it." ) + if ( + codes.is_error(resp.status_code) + and "Content-Length" in resp.headers + and int(resp.headers["Content-Length"]) > 0 + ): + logger.debug(f"Something went wrong: {resp.read().decode('utf-8')}") resp.raise_for_status() def _api_request(