mirror of
https://github.com/pacnpal/Pac-cogs.git
synced 2025-12-20 10:51:05 -05:00
Added missing exceptions to utils/exceptions.py: ResourceExhaustedError ProcessingError CleanupError FileOperationError Fixed exception imports in exceptions.py Added proper re-exports of all exceptions Maintained backward compatibility aliases URL Processing: Added pre-filtering for URLs before yt-dlp checks Added common video platform patterns Reduced error logging noise Improved URL validation efficiency Error Handling: Added proper error types for all operations Enhanced error messages with context Added resource exhaustion checks Improved error propagation Code Organization: Centralized exceptions in utils/exceptions.py Proper re-exports in exceptions.py Consistent error handling across components Better error type hierarchy
78 lines
2.1 KiB
Python
78 lines
2.1 KiB
Python
"""Custom exceptions for VideoArchiver"""
|
|
|
|
class VideoArchiverError(Exception):
|
|
"""Base exception for VideoArchiver errors"""
|
|
pass
|
|
|
|
class VideoDownloadError(VideoArchiverError):
|
|
"""Error downloading video"""
|
|
pass
|
|
|
|
class VideoProcessingError(VideoArchiverError):
|
|
"""Error processing video"""
|
|
pass
|
|
|
|
class VideoVerificationError(VideoArchiverError):
|
|
"""Error verifying video"""
|
|
pass
|
|
|
|
class VideoUploadError(VideoArchiverError):
|
|
"""Error uploading video"""
|
|
pass
|
|
|
|
class VideoCleanupError(VideoArchiverError):
|
|
"""Error cleaning up video files"""
|
|
pass
|
|
|
|
class FileCleanupError(VideoArchiverError):
|
|
"""Error cleaning up files"""
|
|
pass
|
|
|
|
class ConfigurationError(VideoArchiverError):
|
|
"""Error in configuration"""
|
|
pass
|
|
|
|
class PermissionError(VideoArchiverError):
|
|
"""Error with file permissions"""
|
|
pass
|
|
|
|
class NetworkError(VideoArchiverError):
|
|
"""Error with network operations"""
|
|
pass
|
|
|
|
class ResourceError(VideoArchiverError):
|
|
"""Error with system resources"""
|
|
pass
|
|
|
|
class QueueError(VideoArchiverError):
|
|
"""Error with queue operations"""
|
|
pass
|
|
|
|
class ComponentError(VideoArchiverError):
|
|
"""Error with component initialization or cleanup"""
|
|
pass
|
|
|
|
class DiscordAPIError(VideoArchiverError):
|
|
"""Error with Discord API operations"""
|
|
def __init__(self, message: str, status_code: int = None):
|
|
self.status_code = status_code
|
|
super().__init__(f"Discord API Error: {message} (Status: {status_code if status_code else 'Unknown'})")
|
|
|
|
class ResourceExhaustedError(VideoArchiverError):
|
|
"""Error when system resources are exhausted"""
|
|
def __init__(self, message: str, resource_type: str = None):
|
|
self.resource_type = resource_type
|
|
super().__init__(f"Resource exhausted: {message} (Type: {resource_type if resource_type else 'Unknown'})")
|
|
|
|
class ProcessingError(VideoArchiverError):
|
|
"""Error during video processing"""
|
|
pass
|
|
|
|
class CleanupError(VideoArchiverError):
|
|
"""Error during cleanup operations"""
|
|
pass
|
|
|
|
class FileOperationError(VideoArchiverError):
|
|
"""Error during file operations"""
|
|
pass
|