INNER CODE UNIT · Python
TranscriptionError
Kabanosk/whisper-website · src/exceptions.py:7
class TranscriptionError(Exception):
"""Base exception for errors with transcription"""
class ModelTranscriptionError(TranscriptionError):
"""Raised when the Whisper model fails to transcribe the audio."""
class TranslationError(TranscriptionError):
"""Raised when the translation module fails to translate the text."""
def register_exception_handlers(app: FastAPI):
"""Register app-wide handlers for transcription and validation errors."""
@app.exception_handler(TranscriptionError)
def handle_transcription_error(request: Request, exc: TranscriptionError) -> JSONResponse:
logger.error("Transcription request failed: {}", exc)