mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-05-17 06:09:29 +00:00
fix(dl): always report full error trace for download worker failures
Previously, unexpected errors only showed a generic message without the actual exception details or traceback. Simplify the error handler to always include the exception type/message and print the full trace.
This commit is contained in:
@@ -2113,24 +2113,15 @@ class dl:
|
|||||||
except Exception as e: # noqa
|
except Exception as e: # noqa
|
||||||
error_messages = [
|
error_messages = [
|
||||||
":x: Download Failed...",
|
":x: Download Failed...",
|
||||||
|
f" {type(e).__name__}: {e}",
|
||||||
]
|
]
|
||||||
if isinstance(e, EnvironmentError):
|
if hasattr(e, "returncode"):
|
||||||
error_messages.append(f" {e}")
|
error_messages.append(f" Binary call failed, Process exit code: {e.returncode}")
|
||||||
if isinstance(e, ValueError):
|
|
||||||
error_messages.append(f" {e}")
|
|
||||||
if isinstance(e, (AttributeError, TypeError)):
|
|
||||||
console.print_exception()
|
|
||||||
else:
|
|
||||||
error_messages.append(
|
error_messages.append(
|
||||||
" An unexpected error occurred in one of the download workers.",
|
" 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), (1, 5)))
|
console.print(Padding(Group(*error_messages), (1, 5)))
|
||||||
|
console.print_exception()
|
||||||
|
|
||||||
if self.debug_logger:
|
if self.debug_logger:
|
||||||
self.debug_logger.log_error(
|
self.debug_logger.log_error(
|
||||||
|
|||||||
Reference in New Issue
Block a user