Skip to content

Commit

Permalink
fix: make sure a string is always passed to add_failure
Browse files Browse the repository at this point in the history
  • Loading branch information
NTFSvolume committed Jan 30, 2025
1 parent 5ddca21 commit 2e8c141
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions cyberdrop_dl/downloader/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
from aiohttp import ClientError, ClientResponseError
from filedate import File

from cyberdrop_dl.clients.errors import DownloadError, InsufficientFreeSpaceError, RestrictedFiletypeError
from cyberdrop_dl.clients.errors import (
DownloadError,
InsufficientFreeSpaceError,
RestrictedFiletypeError,
create_error_msg,
)
from cyberdrop_dl.utils.constants import CustomHTTPStatus
from cyberdrop_dl.utils.logger import log
from cyberdrop_dl.utils.utilities import error_handling_wrapper
Expand All @@ -24,7 +29,7 @@
from cyberdrop_dl.utils.data_enums_classes.url_objects import MediaItem


def retry(func: Callable) -> None:
def retry(func: Callable) -> Callable:
"""This function is a wrapper that handles retrying for failed downloads."""

@wraps(func)
Expand Down Expand Up @@ -165,7 +170,7 @@ async def download(self, media_item: MediaItem) -> None:
self.attempt_task_removal(media_item)

except (DownloadError, ClientResponseError) as e:
ui_message = getattr(e, "ui_message", e.status)
ui_message = create_error_msg(getattr(e, "ui_message", e.status))
full_message = e.message
if e.message != ui_message:
full_message = f"{e.status} - {e.message}"
Expand Down

0 comments on commit 2e8c141

Please sign in to comment.