Claude Code commited on
Commit
c5a48eb
·
1 Parent(s): 12a0875

Claude Code: fix: add error handling to /api/status endpoint

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -105,14 +105,18 @@ async def interact(request: InteractRequest):
105
  @app.get("/api/status")
106
  async def status():
107
  """Detailed status endpoint."""
108
- status_data = get_system_status()
109
- status_data["endpoints"] = [
110
- {"path": "/", "method": "GET", "description": "System status"},
111
- {"path": "/health", "method": "GET", "description": "Health check"},
112
- {"path": "/api/interact", "method": "POST", "description": "Chat interaction"},
113
- {"path": "/api/status", "method": "GET", "description": "Detailed status"}
114
- ]
115
- return status_data
 
 
 
 
116
 
117
  # ========== Startup ==========
118
  @app.on_event("startup")
 
105
  @app.get("/api/status")
106
  async def status():
107
  """Detailed status endpoint."""
108
+ try:
109
+ status_data = get_system_status()
110
+ status_data["endpoints"] = [
111
+ {"path": "/", "method": "GET", "description": "System status"},
112
+ {"path": "/health", "method": "GET", "description": "Health check"},
113
+ {"path": "/api/interact", "method": "POST", "description": "Chat interaction"},
114
+ {"path": "/api/status", "method": "GET", "description": "Detailed status"}
115
+ ]
116
+ return status_data
117
+ except Exception as e:
118
+ logger.error(f"Status error: {e}")
119
+ raise HTTPException(status_code=500, detail="Failed to get status")
120
 
121
  # ========== Startup ==========
122
  @app.on_event("startup")