Spaces:
Running
Running
AuthorBot
Refactor: complete 10/10 modularity β superadmin/routers/, core/startup/, pipeline/generation.py, slim main.py
f05fb3c | """superadmin/routers/_utils.py β Shared helpers for superadmin sub-routers.""" | |
| import traceback | |
| import structlog | |
| from fastapi.responses import JSONResponse | |
| logger = structlog.get_logger(__name__) | |
| def _err(e: Exception, context: str = "") -> JSONResponse: | |
| """Return a safe JSON 500 response and log the actual traceback.""" | |
| tb = traceback.format_exc() | |
| logger.error("SuperAdmin endpoint error", context=context, error=str(e), traceback=tb) | |
| return JSONResponse( | |
| status_code=500, | |
| content={"detail": "An internal error occurred. Please try again or contact support."}, | |
| ) | |