fix(plugin): guard non-numeric appId, improve 404 error handling

This commit is contained in:
2026-07-13 06:01:08 +08:00
parent 7e016bfa50
commit ed0ed6b089
3 changed files with 9 additions and 3 deletions
+6 -2
View File
@@ -872,8 +872,12 @@ exec mangohud "$@"
return {"error": "Invalid JSON", "status": response.status}
except urllib.error.HTTPError as e:
try:
err = json.loads(e.read().decode("utf-8"))
return {**err, "status": e.code}
raw_body = e.read().decode("utf-8")
try:
err = json.loads(raw_body)
return {**err, "status": e.code}
except json.JSONDecodeError:
return {"error": f"Server returned status {e.code} (non-JSON response)", "status": e.code, "body": raw_body[:200]}
except Exception:
return {"error": f"Server returned status {e.code}", "status": e.code}
except urllib.error.URLError as e: