mirror of https://github.com/devine-dl/devine.git
Print download thread exceptions with rich traceback
This commit is contained in:
parent
70106d32ce
commit
b535715166
|
@ -9,7 +9,6 @@ import re
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
|
@ -472,12 +471,13 @@ class dl:
|
||||||
)):
|
)):
|
||||||
if download.cancelled():
|
if download.cancelled():
|
||||||
continue
|
continue
|
||||||
e = download.exception()
|
try:
|
||||||
if e:
|
download.result()
|
||||||
|
except Exception: # noqa
|
||||||
self.DL_POOL_STOP.set()
|
self.DL_POOL_STOP.set()
|
||||||
pool.shutdown(wait=False, cancel_futures=True)
|
pool.shutdown(wait=False, cancel_futures=True)
|
||||||
traceback.print_exception(type(e), e, e.__traceback__)
|
self.log.error("Download worker threw an unhandled exception:")
|
||||||
self.log.error(f"Download worker threw an unhandled exception: {e!r}")
|
console.print_exception()
|
||||||
return
|
return
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
self.DL_POOL_STOP.set()
|
self.DL_POOL_STOP.set()
|
||||||
|
|
Loading…
Reference in New Issue