fix: improve error handling when reading app state in HTTP handler

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Jakub Dorfman 2026-04-29 18:34:49 +02:00
parent 2c1d267652
commit 435be527d7

View file

@ -554,9 +554,10 @@ class Handler(BaseHTTPRequestHandler):
return return
app, err = read_app_info(name) app, err = read_app_info(name)
if err is not None: if err is not None or app is None:
run_panelctl(["remove", name]) run_panelctl(["remove", name])
self._json(500, {"ok": False, "error": f"failed to read app state: {err.get('error', 'unknown error')}"}) err_msg = (err or {}).get("error", "unknown error") if err else "app state unavailable"
self._json(500, {"ok": False, "error": f"failed to read app state: {err_msg}"})
return return
if source_type == "raw": if source_type == "raw":