fix(core): add fallback to absolute imports in error_handler.py

This commit is contained in:
pacnpal
2024-11-17 22:11:48 +00:00
parent 6c7f7fd5ad
commit fe4353ec96

View File

@@ -14,26 +14,50 @@ from redbot.core.commands import ( # type: ignore
CommandError CommandError
) )
from ..utils.exceptions import ( try:
VideoArchiverError, # Try relative imports first
ErrorSeverity, from ..utils.exceptions import (
ErrorContext, VideoArchiverError,
ProcessorError, ErrorSeverity,
ValidationError, ErrorContext,
DisplayError, ProcessorError,
URLExtractionError, ValidationError,
MessageHandlerError, DisplayError,
QueueHandlerError, URLExtractionError,
QueueProcessorError, MessageHandlerError,
FFmpegError, QueueHandlerError,
DatabaseError, QueueProcessorError,
HealthCheckError, FFmpegError,
TrackingError, DatabaseError,
NetworkError, HealthCheckError,
ResourceExhaustedError, TrackingError,
ConfigurationError NetworkError,
) ResourceExhaustedError,
from ..core.response_handler import response_manager ConfigurationError
)
from ..core.response_handler import response_manager
except ImportError:
# Fall back to absolute imports if relative imports fail
from videoarchiver.utils.exceptions import (
VideoArchiverError,
ErrorSeverity,
ErrorContext,
ProcessorError,
ValidationError,
DisplayError,
URLExtractionError,
MessageHandlerError,
QueueHandlerError,
QueueProcessorError,
FFmpegError,
DatabaseError,
HealthCheckError,
TrackingError,
NetworkError,
ResourceExhaustedError,
ConfigurationError
)
from videoarchiver.core.response_handler import response_manager
logger = logging.getLogger("VideoArchiver") logger = logging.getLogger("VideoArchiver")