From c8d0ec2a5f08d2816f97765cef6597ff6e813f52 Mon Sep 17 00:00:00 2001 From: maxDorninger <97409287+maxDorninger@users.noreply.github.com> Date: Wed, 30 Jul 2025 22:37:57 +0200 Subject: [PATCH] raise Runtime error instead of returning None when final url could not be determined --- media_manager/indexer/utils.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/media_manager/indexer/utils.py b/media_manager/indexer/utils.py index 6caad9b..f933be7 100644 --- a/media_manager/indexer/utils.py +++ b/media_manager/indexer/utils.py @@ -151,10 +151,9 @@ def follow_redirects_to_final_torrent_url(initial_url: str) -> str | None: except requests.exceptions.RequestException as e: log.error(f"An error occurred during the request: {e}") raise RuntimeError(f"An error occurred during the request: {e}") - - if final_url is None: - log.error("Final URL could not be determined. Returning None.") - return None + if not final_url: + log.error("Final URL could not be determined.") + raise RuntimeError("Final URL could not be determined.") if final_url.startswith("http://") or final_url.startswith("https://"): log.info("Final URL protocol: HTTP/HTTPS") elif final_url.startswith("magnet:"):