mirror of
https://github.com/openSUSE/osc.git
synced 2025-11-07 06:33:16 +01:00
Fix TypeError in response_to_exception() in gitea_api
Gitea seems to be inconsistent in including the "errors" entry in responses. It may be completely missing or set to null/None.
This commit is contained in:
@@ -18,7 +18,7 @@ def response_to_exception(response: GiteaHTTPResponse, *, context: Optional[dict
|
||||
for example: ``conn.request("GET", url, context={"owner": owner, "repo": repo})``
|
||||
"""
|
||||
data = response.json()
|
||||
messages = [data["message"]] + data.get("errors", [])
|
||||
messages = [data["message"]] + (data.get("errors", None) or [])
|
||||
|
||||
for cls in EXCEPTION_CLASSES:
|
||||
if cls.RESPONSE_STATUS is not None and cls.RESPONSE_STATUS != response.status:
|
||||
|
||||
Reference in New Issue
Block a user