From 06ad6a83fc2d991908ca2e649f39a1804d1a89c9 Mon Sep 17 00:00:00 2001 From: Douile Date: Tue, 19 Sep 2023 05:40:03 +0100 Subject: [PATCH] Throw error when video not found --- friends_queue/video_queue.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/friends_queue/video_queue.py b/friends_queue/video_queue.py index 1a8e1b2..9e1a136 100644 --- a/friends_queue/video_queue.py +++ b/friends_queue/video_queue.py @@ -13,6 +13,10 @@ from .thumbnail_cache import ThumbnailCache +class VideoNotFoundException(Exception): + """Thrown when a video was not found""" + + @dataclass class VideoQueueItem: """Video Queue item data""" @@ -173,6 +177,7 @@ def run(self): self._has_started = True try: self._do_fetch() + # pylint: disable=bare-except except: self._error = sys.exception() traceback.print_exception(self._error) @@ -182,7 +187,9 @@ def _do_fetch(self): info = self._ytdl.extract_info(self._item.url, download=False) if info is None: - return # TODO: handle error + raise VideoNotFoundException( + f'Unable to find a video that matches "{self._item.url}"' + ) if info.get("_type") == "playlist": info = info.get("entries")[0]