Skip to content

Commit f1c6594

Browse files
authored
fix: details are optional in API errors (#411)
The ansible integrations tests for `certificate_info` were silently failing because the `details` was missing from the API error. https://dev.azure.com/ansible/hetzner.hcloud/_build/results?buildId=116526&view=logs&j=790943b1-2131-5e64-166b-e241853dcaf1&t=4ad41445-2459-50a0-f330-095184dc0a34&l=641
1 parent bce5e94 commit f1c6594

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

hcloud/_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def request( # type: ignore[no-untyped-def]
247247
raise APIException(
248248
code=error["code"],
249249
message=error["message"],
250-
details=error["details"],
250+
details=error.get("details"),
251251
correlation_id=correlation_id,
252252
)
253253

tests/unit/test_client.py

-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ def test_request_fails_correlation_id(self, client, response):
110110
"error": {
111111
"code": "conflict",
112112
"message": "some conflict",
113-
"details": None,
114113
}
115114
}
116115
).encode("utf-8")

0 commit comments

Comments
 (0)