mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-24 18:47:53 -06:00
fix: name a failed standalone release fetch
resolve and fetch let a GitHub listing or download failure end on a traceback: the listing raises ProbeError, and fetch also prints forge and HTTP failures as an ERROR line with exit 1.
This commit is contained in:
1 parent
676d0a5d9a
commit
e24c5b6900
1 file changed
+10
-3
@@ -28,6 +28,7 @@ from __future__ import annotations
|
||||
import argparse
|
||||
import contextlib
|
||||
import hashlib
|
||||
import http.client
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
@@ -233,7 +234,7 @@ def github_releases(repo: str) -> list[dict]:
|
||||
from scraper.base_scraper import github_json
|
||||
|
||||
return github_json(f"https://api.github.com/repos/{repo}/releases",
|
||||
f"cannot list the releases of {repo}", timeout=60)
|
||||
f"cannot list the releases of {repo}", timeout=60, error=cp.ProbeError)
|
||||
|
||||
|
||||
def fetch(emu: Emulator, cache: Path = CACHE) -> dict:
|
||||
@@ -692,14 +693,20 @@ def main(argv: Sequence[str] | None = None) -> int:
|
||||
args = build_parser().parse_args(argv)
|
||||
emu = EMULATORS[args.emulator]
|
||||
if args.mode == "resolve":
|
||||
asset = select_asset(github_releases(emu.repo), emu.asset_endswith, emu.asset_contains)
|
||||
try:
|
||||
releases = github_releases(emu.repo)
|
||||
except cp.ProbeError as exc:
|
||||
print(f"ERROR: {exc}", file=sys.stderr)
|
||||
return 1
|
||||
asset = select_asset(releases, emu.asset_endswith, emu.asset_contains)
|
||||
print(json.dumps({"emulator": emu.name, "platform": emu.platform,
|
||||
"installer_ref": emu.installer_ref, "asset": asset}, indent=2))
|
||||
return 0 if asset else 1
|
||||
if args.mode == "fetch":
|
||||
try:
|
||||
print(json.dumps(fetch(emu), indent=2))
|
||||
except (cp.ProbeError, OSError, subprocess.CalledProcessError) as exc:
|
||||
except (cp.ProbeError, upstream.UpstreamError, OSError, http.client.HTTPException,
|
||||
subprocess.CalledProcessError) as exc:
|
||||
print(f"ERROR: {exc}", file=sys.stderr)
|
||||
return 1
|
||||
return 0
|
||||
|
||||
Reference in new issue
Block a user