diff --git a/hcloud/_client.py b/hcloud/_client.py index 1da0645..a0de13a 100644 --- a/hcloud/_client.py +++ b/hcloud/_client.py @@ -247,7 +247,7 @@ def request( # type: ignore[no-untyped-def] raise APIException( code=error["code"], message=error["message"], - details=error["details"], + details=error.get("details"), correlation_id=correlation_id, ) diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py index 7d8b5f9..e258a51 100644 --- a/tests/unit/test_client.py +++ b/tests/unit/test_client.py @@ -110,7 +110,6 @@ def test_request_fails_correlation_id(self, client, response): "error": { "code": "conflict", "message": "some conflict", - "details": None, } } ).encode("utf-8")