mirror of https://github.com/devine-dl/devine.git
refactor(dl): Improve readability of download worker errors
Now it will no longer print the full traceback for errors caused by a missing binary file. Other errors still include it and now explicitly label them as unexpected. CalledProcessError handling is now merged with all non-environment related errors and explicitly mentions that a binary call failed.
This commit is contained in:
parent
fd64e6acf4
commit
f23100077e
|
@ -547,13 +547,16 @@ class dl:
|
|||
except Exception as e: # noqa
|
||||
error_messages = [
|
||||
":x: Download Failed...",
|
||||
" One of the track downloads had an error!",
|
||||
" 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}")
|
||||
if isinstance(e, EnvironmentError):
|
||||
error_messages.append(f" {e}")
|
||||
else:
|
||||
error_messages.append(" An unexpected error occurred in one of the download workers.",)
|
||||
if hasattr(e, "returncode"):
|
||||
error_messages.append(f" Binary call failed, Process exit code: {e.returncode}")
|
||||
error_messages.append(" See the error trace above for more information.")
|
||||
if isinstance(e, subprocess.CalledProcessError):
|
||||
# CalledProcessError already lists the exception trace
|
||||
console.print_exception()
|
||||
console.print(Padding(
|
||||
Group(*error_messages),
|
||||
|
|
Loading…
Reference in New Issue