feat: enhance error handling with custom HTTP exception responses and middleware improvements

This commit is contained in:
2026-02-16 13:18:42 -06:00
parent ffc82ea82b
commit e6ef5c9094
4 changed files with 56 additions and 24 deletions

View File

@@ -70,18 +70,6 @@ async def validation_exception_handler(request: Request, exc: RequestValidationE
)
# Add HTTP exception handler
@app.exception_handler(HTTPException)
async def http_exception_handler(request: Request, exc: HTTPException):
logger.error(
f"HTTP {exc.status_code} for {request.method} {request.url.path}: {exc.detail}"
)
return JSONResponse(
status_code=exc.status_code,
content={"detail": exc.detail},
)
def run_migrations():
subprocess.run(["alembic", "upgrade", "head"], check=True)