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,14 +547,17 @@ class dl:
|
||||||
except Exception as e: # noqa
|
except Exception as e: # noqa
|
||||||
error_messages = [
|
error_messages = [
|
||||||
":x: Download Failed...",
|
":x: Download Failed...",
|
||||||
" One of the track downloads had an error!",
|
|
||||||
" See the error trace above for more information."
|
|
||||||
]
|
]
|
||||||
if isinstance(e, subprocess.CalledProcessError):
|
if isinstance(e, EnvironmentError):
|
||||||
# ignore process exceptions as proper error logs are already shown
|
error_messages.append(f" {e}")
|
||||||
error_messages.append(f" Process exit code: {e.returncode}")
|
|
||||||
else:
|
else:
|
||||||
console.print_exception()
|
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(
|
console.print(Padding(
|
||||||
Group(*error_messages),
|
Group(*error_messages),
|
||||||
(1, 5)
|
(1, 5)
|
||||||
|
|
Loading…
Reference in New Issue