Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Better error reporting than "1"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jules-WinnfieldX committed Mar 17, 2024
1 parent 09ed05d commit a4fafb3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cyberdrop_dl/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.2.7"
__version__ = "5.2.8"
25 changes: 11 additions & 14 deletions cyberdrop_dl/downloader/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,19 +362,9 @@ async def download(self, media_item: MediaItem) -> None:
await self.manager.progress_manager.download_progress.add_completed()
return

except (aiohttp.ServerDisconnectedError, asyncio.TimeoutError, aiohttp.ServerTimeoutError) as e:
if partial_file and partial_file.is_file():
size = partial_file.stat().st_size
if partial_file.name in self._current_attempt_filesize and self._current_attempt_filesize[media_item.filename] >= size:
raise DownloadFailure(status=getattr(e, "status", 1), message="Download timeout reached, retrying")
self._current_attempt_filesize[media_item.filename] = size
media_item.current_attempt = 0
raise DownloadFailure(status=999, message="Download timeout reached, retrying")

raise DownloadFailure(status=getattr(e, "status", 1), message=repr(e))

except (aiohttp.ClientPayloadError, aiohttp.ClientOSError, aiohttp.ClientResponseError, ConnectionResetError,
DownloadFailure, FileNotFoundError, PermissionError) as e:
DownloadFailure, FileNotFoundError, PermissionError, aiohttp.ServerDisconnectedError,
asyncio.TimeoutError, aiohttp.ServerTimeoutError) as e:
if hasattr(e, "status"):
if ((await is_4xx_client_error(e.status) and e.status != HTTPStatus.TOO_MANY_REQUESTS)
or e.status == HTTPStatus.SERVICE_UNAVAILABLE
Expand All @@ -392,7 +382,14 @@ async def download(self, media_item: MediaItem) -> None:
else:
await log(f"Download Failed: {media_item.url} with status {e.status}", 40)
await self.manager.log_manager.write_download_error_log(media_item.url, f" {e.status}")

return

raise DownloadFailure(status=getattr(e, "status", 1), message=getattr(e, "message", repr(e)))
if partial_file and partial_file.is_file():
size = partial_file.stat().st_size
if partial_file.name in self._current_attempt_filesize and self._current_attempt_filesize[media_item.filename] >= size:
raise DownloadFailure(status=getattr(e, "status", type(e).__name__), message="Download failed")
self._current_attempt_filesize[media_item.filename] = size
media_item.current_attempt = 0
raise DownloadFailure(status=999, message="Download timeout reached, retrying")

raise DownloadFailure(status=getattr(e, "status", type(e).__name__), message=repr(e))
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cyberdrop-dl"
version = "5.2.7"
version = "5.2.8"
description = "Bulk downloader for multiple file hosts"
authors = ["Jules Winnfield <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit a4fafb3

Please sign in to comment.