Added some try catch

This commit is contained in:
CakesTwix 2025-02-01 17:01:14 +02:00
parent 37441d2dd4
commit 64559d3668
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825

View file

@ -29,9 +29,16 @@ def titles_route():
if image_cache:
titles[title]["image"] = image_cache.image
else:
try:
toloka_torrent = config.toloka.get_torrent(
f"https://toloka.to/{titles[title]['guid']}"
)
except AttributeError as e:
print(f"https://toloka.to/{titles[title]['guid']}")
config.logger.warning(
f"Failed to get https://toloka.to/{titles[title]['guid']} torrent: {str(e)}"
)
pass
toloka_img = (
f"https:{toloka_torrent.img}"
if toloka_torrent.img.startswith("//")