INNER CODE UNIT · Python
global_exception_handler
mostly-ai/mostlyai · mostlyai/sdk/_local/server.py:123
async def global_exception_handler(request, exc):
if isinstance(exc, ValidationError):
return JSONResponse(status_code=422, content={"detail": str(exc)})
# for fastapi.HTTPException: it will be raised as is
# for other unhandled exceptions: client will receive a 500 Internal Server Error
raise exc