Skip to content

Commit

Permalink
refactor: use ClientException instead
Browse files Browse the repository at this point in the history
  • Loading branch information
winstxnhdw committed Sep 6, 2024
1 parent 946e7f5 commit 5db5ec3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/api/v1/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from litestar import Controller, post
from litestar.datastructures import UploadFile
from litestar.enums import RequestEncodingType
from litestar.exceptions import HTTPException
from litestar.exceptions import ClientException
from litestar.params import Body
from litestar.status_codes import HTTP_200_OK, HTTP_400_BAD_REQUEST
from litestar.status_codes import HTTP_200_OK

from server.features import Transcriber
from server.schemas.v1 import Transcribed
Expand All @@ -33,6 +33,6 @@ async def transcribe(
the POST variant of the `/transcribe` route
"""
if not (result := await Transcriber.transcribe(BytesIO(await data.read()), caption_format)):
raise HTTPException(detail=f'Invalid format: {caption_format}!', status_code=HTTP_400_BAD_REQUEST)
raise ClientException(detail=f'Invalid format: {caption_format}!')

return Transcribed(result=result)

0 comments on commit 5db5ec3

Please sign in to comment.