feat: enhance error handling with custom HTTP exception responses and middleware improvements
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user