"""Exception handlers for FastAPI.""" from fastapi import Request, status from fastapi.responses import JSONResponse from app.core.exceptions import AppException async def app_exception_handler(request: Request, exc: AppException): """Handle application exceptions.""" return JSONResponse( status_code=status.HTTP_400_BAD_REQUEST, content={ "code": exc.code, "message": exc.message, "details": exc.details, } ) async def generic_exception_handler(request: Request, exc: Exception): """Handle generic exceptions.""" return JSONResponse( status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, content={ "code": 50000, "message": "Internal server error", "details": {}, } )