From 0dded2ab026eebabaa597457d8c9bed1d0f57144 Mon Sep 17 00:00:00 2001 From: 64Core Date: Wed, 8 Jun 2022 21:26:16 -0500 Subject: [PATCH] Testing some rudimentary error handling in download_library to look at issue #57 --- itchiodl/library.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/itchiodl/library.py b/itchiodl/library.py index 26c49f8..fb7621a 100644 --- a/itchiodl/library.py +++ b/itchiodl/library.py @@ -83,10 +83,20 @@ def download_library(self, platform=None): lock = threading.RLock() def dl(i, g): - x = g.download(self.login, platform) - with lock: - i[0] += 1 - print(f"Downloaded {g.name} ({i[0]} of {l})") - return x + try: + x = g.download(self.login, platform) + except: + with lock: + with open("errors.txt", "a") as f: + f.write( + f""" Cannot download game/asset: {g.name} + This game/asset has been skipped please download manually + ---------------------------------------------------------\n """ + ) + finally: + with lock: + i[0] += 1 + print(f"Downloaded {g.name} ({i[0]} of {l})") + return x executor.map(functools.partial(dl, i), self.games)