Skip to content

Commit 208f01b

Browse files
committed
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'
1 parent fccd67f commit 208f01b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mergin/client_pull.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ def download_project_is_running(job):
199199
"""
200200
for future in job.futures:
201201
if future.done() and future.exception() is not None:
202-
job.mp.log.error(
203-
"Error while downloading project: " + "".join(traceback.format_exception(future.exception()))
204-
)
202+
exc = future.exception()
203+
traceback_lines = traceback.format_exception(type(exc), exc, exc.__traceback__)
204+
job.mp.log.error("Error while downloading project: " + "".join(traceback_lines))
205205
job.mp.log.info("--- download aborted")
206206
job.failure_log_file = _cleanup_failed_download(job.directory, job.mp)
207207
raise future.exception()
@@ -225,9 +225,9 @@ def download_project_finalize(job):
225225
# make sure any exceptions from threads are not lost
226226
for future in job.futures:
227227
if future.exception() is not None:
228-
job.mp.log.error(
229-
"Error while downloading project: " + "".join(traceback.format_exception(future.exception()))
230-
)
228+
exc = future.exception()
229+
traceback_lines = traceback.format_exception(type(exc), exc, exc.__traceback__)
230+
job.mp.log.error("Error while downloading project: " + "".join(traceback_lines))
231231
job.mp.log.info("--- download aborted")
232232
job.failure_log_file = _cleanup_failed_download(job.directory, job.mp)
233233
raise future.exception()

0 commit comments

Comments
 (0)