INNER CODE UNIT · Python
global_exception_handler
SearchSavior/OpenArc · src/server/main.py:116
async def global_exception_handler(request: Request, exc: Exception):
logger.error(f"Unhandled exception: {exc}", exc_info=True)
logger.error(f"Full traceback:\n{''.join(traceback.format_tb(exc.__traceback__))}")
return JSONResponse(
status_code=500, content={"status": "error", "detail": str(exc)}
)
@app.get("/readyz")
async def readyz():
"""Readiness probe: 200 when every model that should be loaded is loaded.
Intentionally unauthenticated so orchestrators (e.g. Kubernetes) can probe
it without credentials.
"""
result = await _registry.readiness()
status_code = 200 if result["ready"] else 503
return JSONResponse(status_code=status_code, content=result)