-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
This is somewhat related to #523, as it causes this issue to pop up quite often, but the duffy client should handle non-successful HTTP codes instead of throwing exceptions around, to make it consistent with the rest of the DuffyAPIErrorModel:
2022-08-05 09:30:42,932 [agent-control/allocate_node] INFO: Attempting to allocate a node from pool metal-seamicro-large-centos-8s-x86_64
2022-08-05 09:30:43,446 [agent-control/main] ERROR: Execution failed
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/duffy/client/main.py", line 101, in _query_method
return DuffyAPIErrorModel(error=response.json())
File "/usr/local/lib/python3.8/site-packages/httpx/_models.py", line 743, in json
return jsonlib.loads(self.text, **kwargs)
File "/usr/lib64/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./agent-control.py", line 315, in main
node = ac.allocate_node(args.pool)
File "./agent-control.py", line 59, in allocate_node
result = self._client.request_session([payload])
File "/usr/local/lib/python3.8/site-packages/duffy/client/main.py", line 123, in request_session
return self._query_method(
File "/usr/local/lib/python3.8/site-packages/duffy/client/main.py", line 103, in _query_method
response.raise_for_status()
File "/usr/local/lib/python3.8/site-packages/httpx/_models.py", line 736, in raise_for_status
raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Server error '500 Internal Server Error' for url 'https://duffy.ci.centos.org/api/v1/sessions'
For more information check: https://httpstatuses.com/500Ideally it should fill the DuffyAPIErrorModel with the HTTP status error details and pass it down as usual, to make error handling consistent.
Metadata
Metadata
Assignees
Labels
No labels