fix: improve error handling and refactor app initialization process in HTTP handler
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
435be527d7
commit
197926a8a8
1 changed files with 96 additions and 92 deletions
|
|
@ -548,6 +548,7 @@ class Handler(BaseHTTPRequestHandler):
|
||||||
self._json(400, {"ok": False, "error": "invalid source_type"})
|
self._json(400, {"ok": False, "error": "invalid source_type"})
|
||||||
return
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
result = run_panelctl(["init", name, domain, port, auth])
|
result = run_panelctl(["init", name, domain, port, auth])
|
||||||
if not result["ok"]:
|
if not result["ok"]:
|
||||||
self._json(400, result)
|
self._json(400, result)
|
||||||
|
|
@ -654,6 +655,9 @@ class Handler(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
|
|
||||||
self._json(200, {"ok": True, "code": 0, "stdout": "initialized successfully"})
|
self._json(200, {"ok": True, "code": 0, "stdout": "initialized successfully"})
|
||||||
|
except Exception as exc:
|
||||||
|
run_panelctl(["remove", name])
|
||||||
|
self._json(500, {"ok": False, "error": f"init failed: {exc}"})
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(parts) >= 3 and parts[0] == "apps":
|
if len(parts) >= 3 and parts[0] == "apps":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue