whisper.api / app /utils /exception.py
Ved Gupta
Test Added and some user route updated
0359012
raw
history blame contribute delete
527 Bytes
import logging
logger = logging.getLogger(__name__)
from fastapi import HTTPException, status
def handle_exceptions(func):
async def wrapper(*args, **kwargs):
try:
return await func(*args, **kwargs)
except HTTPException as exc:
logger.error(exc)
raise exc
except Exception as exc:
logger.error(exc)
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST, detail=str(exc)
) from exc
return wrapper