mirror of https://github.com/devine-dl/devine.git
Don't print traceback of subprocess errors on download failures
Since we now have pretty logs for them, the exception (which would be a CalledProcessError) would be generally pointless. However, the return code may be useful so that is kept.
This commit is contained in:
parent
9d6adec707
commit
714e9af99a
|
@ -6,6 +6,7 @@ import math
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
|
@ -483,14 +484,19 @@ class dl:
|
||||||
(0, 5, 1, 5)
|
(0, 5, 1, 5)
|
||||||
))
|
))
|
||||||
return
|
return
|
||||||
except Exception: # noqa
|
except Exception as e: # noqa
|
||||||
console.print_exception()
|
error_messages = [
|
||||||
console.print(Padding(
|
|
||||||
Group(
|
|
||||||
":x: Download Failed...",
|
":x: Download Failed...",
|
||||||
" One of the download workers had an error!",
|
" One of the download workers had an error!",
|
||||||
" See the error trace above for more information."
|
" See the error trace above for more information."
|
||||||
),
|
]
|
||||||
|
if isinstance(e, subprocess.CalledProcessError):
|
||||||
|
# ignore process exceptions as proper error logs are already shown
|
||||||
|
error_messages.append(f" Process exit code: {e.returncode}")
|
||||||
|
else:
|
||||||
|
console.print_exception()
|
||||||
|
console.print(Padding(
|
||||||
|
Group(*error_messages),
|
||||||
(1, 5)
|
(1, 5)
|
||||||
))
|
))
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue