unity4ar commited on
Commit
a5ce744
·
verified ·
1 Parent(s): 5b4e454

Log + surface RuntimeErrors from witness chat too (still 503 for those)

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -240,13 +240,12 @@ def build_app() -> gr.Server:
240
  return api_witness_message(game_id, witness_id, str(payload.get("message") or ""))
241
  except HTTPException:
242
  raise
243
- except RuntimeError as exc:
244
- raise HTTPException(status_code=503, detail=str(exc)) from exc
245
  except Exception as exc:
246
  import traceback
247
  tb = traceback.format_exc()
248
  print(f"[witness_message_route] FAILED: {tb}", flush=True)
249
- raise HTTPException(status_code=500, detail=f"{exc.__class__.__name__}: {exc}") from exc
 
250
 
251
  @app.websocket("/ws/witness/{game_id}/{witness_id}")
252
  async def witness_socket(websocket: WebSocket, game_id: str, witness_id: str) -> None:
 
240
  return api_witness_message(game_id, witness_id, str(payload.get("message") or ""))
241
  except HTTPException:
242
  raise
 
 
243
  except Exception as exc:
244
  import traceback
245
  tb = traceback.format_exc()
246
  print(f"[witness_message_route] FAILED: {tb}", flush=True)
247
+ status = 503 if isinstance(exc, RuntimeError) else 500
248
+ raise HTTPException(status_code=status, detail=f"{exc.__class__.__name__}: {exc}") from exc
249
 
250
  @app.websocket("/ws/witness/{game_id}/{witness_id}")
251
  async def witness_socket(websocket: WebSocket, game_id: str, witness_id: str) -> None: