tts-openai / src /routers /exception_handler.py
imseldrith's picture
Upload folder using huggingface_hub
f32a529 verified
raw
history blame
342 Bytes
from fastapi import Request, status
from fastapi.encoders import jsonable_encoder
from fastapi.responses import JSONResponse
async def validation_exception_handler(request: Request, exc: ValueError):
return JSONResponse(
status_code=status.HTTP_400_BAD_REQUEST,
content=jsonable_encoder({"detail": exc.errors()}),
)