From 84e513b0c1837098cbe1c3aeb083449d190d7415 Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Fri, 13 Oct 2023 23:06:10 +0200 Subject: [PATCH] Check for empty responses --- pyiceberg/catalog/rest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyiceberg/catalog/rest.py b/pyiceberg/catalog/rest.py index ad2c510d03..20875d313d 100644 --- a/pyiceberg/catalog/rest.py +++ b/pyiceberg/catalog/rest.py @@ -319,6 +319,10 @@ def _split_identifier_for_json(self, identifier: Union[str, Identifier]) -> Dict def _handle_non_200_response(self, exc: HTTPError, error_handler: Dict[int, Type[Exception]]) -> None: exception: Type[Exception] + + if exc.response is None: + raise ValueError("Did not receive a response") + code = exc.response.status_code if code in error_handler: exception = error_handler[code]