Fix: Use yt_dlp.utils.DownloadCancelled for proper download cancellation
- Import and use DownloadCancelled exception which YT-DLP properly handles - Add InterruptedError handling throughout the call chain - Fire 'cancelled' status event when download is cancelled - Handle InterruptedError in DownloadService to set CANCELLED status
This commit is contained in:
@@ -846,6 +846,7 @@ class AnimeService:
|
||||
|
||||
Raises:
|
||||
AnimeServiceError: If download fails
|
||||
InterruptedError: If download was cancelled
|
||||
|
||||
Note:
|
||||
The 'key' parameter is the primary identifier used for all
|
||||
@@ -864,6 +865,10 @@ class AnimeService:
|
||||
key=key,
|
||||
item_id=item_id,
|
||||
)
|
||||
except InterruptedError:
|
||||
# Download was cancelled - re-raise for proper handling
|
||||
logger.info("Download cancelled, propagating cancellation")
|
||||
raise
|
||||
except Exception as exc:
|
||||
logger.exception("download failed")
|
||||
raise AnimeServiceError("Download failed") from exc
|
||||
|
||||
Reference in New Issue
Block a user