mirror of https://github.com/devine-dl/devine.git
Handle download worker exceptions outside thread loop
This is so that I can start to log information after the track listing. It's also not necessary to have the try catch within the loop, when both methods will have exited the loop.
This commit is contained in:
parent
624bb6fe75
commit
fbe78308eb
|
@ -34,6 +34,7 @@ from rich.rule import Rule
|
|||
from rich.table import Table
|
||||
from rich.text import Text
|
||||
from rich.tree import Tree
|
||||
from rich.console import Group
|
||||
|
||||
from devine.core.config import config
|
||||
from devine.core.console import console
|
||||
|
@ -474,19 +475,24 @@ class dl:
|
|||
)
|
||||
for i, track in enumerate(title.tracks)
|
||||
)):
|
||||
try:
|
||||
download.result()
|
||||
except Exception: # noqa
|
||||
self.DL_POOL_STOP.set()
|
||||
self.log.error("Download worker threw an unhandled exception:")
|
||||
console.print_exception()
|
||||
return
|
||||
except KeyboardInterrupt:
|
||||
console.print(Padding(
|
||||
":x: Download Cancelled...",
|
||||
(0, 5, 1, 5)
|
||||
))
|
||||
return
|
||||
except Exception: # noqa
|
||||
console.print_exception()
|
||||
console.print(Padding(
|
||||
Group(
|
||||
":x: Download Failed...",
|
||||
" One of the download workers had an error!",
|
||||
" See the error trace above for more information."
|
||||
),
|
||||
(1, 5)
|
||||
))
|
||||
return
|
||||
|
||||
video_track_n = 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue