refactor: improve PDF extraction, error handling, and proxy configuration
This commit is contained in:
-10
@@ -13,9 +13,7 @@ from app.config import settings
|
||||
from app.exceptions import (
|
||||
AppError,
|
||||
ConflictError,
|
||||
ExternalAPIError,
|
||||
NotFoundError,
|
||||
PdfProcessError,
|
||||
ValidationError,
|
||||
)
|
||||
from app.database import engine, init_db
|
||||
@@ -87,14 +85,6 @@ def create_app() -> FastAPI:
|
||||
async def _validation_handler(request, exc):
|
||||
return JSONResponse(status_code=400, content={"error": exc.message})
|
||||
|
||||
@app.exception_handler(ExternalAPIError)
|
||||
async def _external_api_handler(request, exc):
|
||||
return JSONResponse(status_code=502, content={"error": exc.message})
|
||||
|
||||
@app.exception_handler(PdfProcessError)
|
||||
async def _pdf_process_handler(request, exc):
|
||||
return JSONResponse(status_code=500, content={"error": exc.message})
|
||||
|
||||
@app.exception_handler(ConflictError)
|
||||
async def _conflict_handler(request, exc):
|
||||
return JSONResponse(status_code=409, content={"error": exc.message})
|
||||
|
||||
Reference in New Issue
Block a user