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
acff082d09
commit
eac94061d0
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"})
|
||||
return
|
||||
|
||||
try:
|
||||
result = run_panelctl(["init", name, domain, port, auth])
|
||||
if not result["ok"]:
|
||||
self._json(400, result)
|
||||
|
|
@ -654,6 +655,9 @@ class Handler(BaseHTTPRequestHandler):
|
|||
return
|
||||
|
||||
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
|
||||
|
||||
if len(parts) >= 3 and parts[0] == "apps":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue