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 009b8016bb
commit acff082d09

View file

@ -554,9 +554,10 @@ class Handler(BaseHTTPRequestHandler):
return
app, err = read_app_info(name)
if err is not None:
if err is not None or app is None:
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
if source_type == "raw":