utkarsh134 commited on
Commit
fa57cb0
·
verified ·
1 Parent(s): 647b3bc

Delete services/audio_error_handling.py

Browse files
Files changed (1) hide show
  1. services/audio_error_handling.py +0 -52
services/audio_error_handling.py DELETED
@@ -1,52 +0,0 @@
1
- import logging
2
- import sys
3
- from pathlib import Path
4
-
5
- # Configure logging
6
- LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
7
- LOG_LEVEL = logging.INFO
8
- LOG_DIR = Path(__file__).parent.parent / 'logs'
9
- LOG_DIR.mkdir(exist_ok=True)
10
-
11
- # File handler
12
- file_handler = logging.FileHandler(LOG_DIR / 'audio_processing.log')
13
- file_handler.setFormatter(logging.Formatter(LOG_FORMAT))
14
-
15
- # Console handler
16
- console_handler = logging.StreamHandler(sys.stdout)
17
- console_handler.setFormatter(logging.Formatter(LOG_FORMAT))
18
-
19
- # Create logger
20
- logger = logging.getLogger('audio_service')
21
- logger.setLevel(LOG_LEVEL)
22
- logger.addHandler(file_handler)
23
- logger.addHandler(console_handler)
24
-
25
- class AudioProcessingError(Exception):
26
- """Base exception for audio processing errors"""
27
- pass
28
-
29
- class AudioTranscriptionError(AudioProcessingError):
30
- """Exception raised for errors during audio transcription"""
31
- pass
32
-
33
- class AudioAnalysisError(AudioProcessingError):
34
- """Exception raised for errors during audio analysis"""
35
- pass
36
-
37
- class AudioFormatError(AudioProcessingError):
38
- """Exception raised for unsupported audio formats"""
39
- pass
40
-
41
- def handle_audio_error(func):
42
- """Decorator for handling audio processing errors"""
43
- def wrapper(*args, **kwargs):
44
- try:
45
- return func(*args, **kwargs)
46
- except AudioProcessingError as e:
47
- logger.error(f"Audio processing error in {func.__name__}: {str(e)}")
48
- raise
49
- except Exception as e:
50
- logger.error(f"Unexpected error in {func.__name__}: {str(e)}", exc_info=True)
51
- raise AudioProcessingError(f"An unexpected error occurred: {str(e)}")
52
- return wrapper