From b535715166cefa8a12eccae1c76fc72609064ec6 Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sat, 25 Feb 2023 17:47:59 +0000 Subject: [PATCH] Print download thread exceptions with rich traceback --- devine/commands/dl.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/devine/commands/dl.py b/devine/commands/dl.py index 056a347..27954f0 100644 --- a/devine/commands/dl.py +++ b/devine/commands/dl.py @@ -9,7 +9,6 @@ import re import shutil import sys import time -import traceback from concurrent import futures from concurrent.futures import ThreadPoolExecutor from copy import deepcopy @@ -472,12 +471,13 @@ class dl: )): if download.cancelled(): continue - e = download.exception() - if e: + try: + download.result() + except Exception: # noqa self.DL_POOL_STOP.set() pool.shutdown(wait=False, cancel_futures=True) - traceback.print_exception(type(e), e, e.__traceback__) - self.log.error(f"Download worker threw an unhandled exception: {e!r}") + self.log.error("Download worker threw an unhandled exception:") + console.print_exception() return except KeyboardInterrupt: self.DL_POOL_STOP.set()