From feae5771086767c37a605750c5912cb05e8f17e8 Mon Sep 17 00:00:00 2001 From: Floweynt Date: Fri, 11 Sep 2026 20:55:44 +0000 Subject: [PATCH] ci: log gitea API error responses --- ci.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ci.py b/ci.py index 86eafef..dca9269 100644 --- a/ci.py +++ b/ci.py @@ -33,8 +33,11 @@ def gitea(method, path, body=None): req.add_header("Authorization", f'token {os.environ["GH_TOKEN"]}') if data is not None: req.add_header("Content-Type", "application/json") - with urllib.request.urlopen(req) as resp: - raw = resp.read() + try: + with urllib.request.urlopen(req) as resp: + raw = resp.read() + except urllib.error.HTTPError as e: + sys.exit(f"gitea {method} {path}: {e.code} {e.reason}\n{e.read().decode()}") return json.loads(raw) if raw else None