From b4c4b8409fe64c3fe073faa7f8949ae0477494fa Mon Sep 17 00:00:00 2001 From: Martin Dobias Date: Mon, 22 Apr 2024 15:52:00 +0200 Subject: [PATCH] Fix call to format_exception() download project fails Some users were getting this exception while handling download error: TypeError: format_exception() missing 2 required positional arguments: 'value' and 'tb' --- mergin/client_pull.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mergin/client_pull.py b/mergin/client_pull.py index 05a2dd6..658f2d9 100644 --- a/mergin/client_pull.py +++ b/mergin/client_pull.py @@ -199,9 +199,9 @@ def download_project_is_running(job): """ for future in job.futures: if future.done() and future.exception() is not None: - job.mp.log.error( - "Error while downloading project: " + "".join(traceback.format_exception(future.exception())) - ) + exc = future.exception() + traceback_lines = traceback.format_exception(type(exc), exc, exc.__traceback__) + job.mp.log.error("Error while downloading project: " + "".join(traceback_lines)) job.mp.log.info("--- download aborted") job.failure_log_file = _cleanup_failed_download(job.directory, job.mp) raise future.exception() @@ -225,9 +225,9 @@ def download_project_finalize(job): # make sure any exceptions from threads are not lost for future in job.futures: if future.exception() is not None: - job.mp.log.error( - "Error while downloading project: " + "".join(traceback.format_exception(future.exception())) - ) + exc = future.exception() + traceback_lines = traceback.format_exception(type(exc), exc, exc.__traceback__) + job.mp.log.error("Error while downloading project: " + "".join(traceback_lines)) job.mp.log.info("--- download aborted") job.failure_log_file = _cleanup_failed_download(job.directory, job.mp) raise future.exception()