]> jfr.im git - yt-dlp.git/commitdiff
[fragment] Handle errors in threads correctly
authorpukkandan <redacted>
Tue, 6 Jul 2021 20:25:54 +0000 (01:55 +0530)
committerpukkandan <redacted>
Tue, 6 Jul 2021 20:25:54 +0000 (01:55 +0530)
yt_dlp/downloader/fragment.py

index c499e5e2b643e3cafe2f41c7e81e15110d475350..8e211c766bc80c5d7b350c6504c7f6a907b7652d 100644 (file)
@@ -402,13 +402,9 @@ def append_fragment(frag_content, frag_index, ctx):
         if can_threaded_download and max_workers > 1:
 
             def _download_fragment(fragment):
-                try:
-                    ctx_copy = ctx.copy()
-                    frag_content, frag_index = download_fragment(fragment, ctx_copy)
-                    return fragment, frag_content, frag_index, ctx_copy.get('fragment_filename_sanitized')
-                except Exception:
-                    # Return immediately on exception so that it is raised in the main thread
-                    return
+                ctx_copy = ctx.copy()
+                frag_content, frag_index = download_fragment(fragment, ctx_copy)
+                return fragment, frag_content, frag_index, ctx_copy.get('fragment_filename_sanitized')
 
             self.report_warning('The download speed shown is only of one thread. This is a known issue and patches are welcome')
             with concurrent.futures.ThreadPoolExecutor(max_workers) as pool: