From 308164f44eb11f4ce52912f40ccf013c5e00799c Mon Sep 17 00:00:00 2001 From: Magnus Holm Date: Fri, 21 Sep 2018 10:55:44 +0200 Subject: [PATCH 1/2] conda_mirror.py: log download errors instead of breaking and clearing cache --- conda_mirror/conda_mirror.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/conda_mirror/conda_mirror.py b/conda_mirror/conda_mirror.py index 5be6126..72544dd 100644 --- a/conda_mirror/conda_mirror.py +++ b/conda_mirror/conda_mirror.py @@ -682,8 +682,12 @@ def main(upstream_channel, target_directory, temp_directory, platform, channel=channel, platform=platform, file_name=package_name) - _download(url, download_dir) - summary['downloaded'].add((url, download_dir)) + try: + _download(url, download_dir) + summary['downloaded'].add((url, download_dir)) + except: + logger.error('Unexpected error: %s. Aborting download.', sys.exc_info()[0]) + break # validate all packages in the download directory validation_results = _validate_packages(packages, download_dir, From e3c9a0d60bbb11927bdc692629c55947747094c1 Mon Sep 17 00:00:00 2001 From: Peter Parente Date: Fri, 12 Oct 2018 22:13:56 -0400 Subject: [PATCH 2/2] Log full exception, fix flake8 errs --- conda_mirror/conda_mirror.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/conda_mirror/conda_mirror.py b/conda_mirror/conda_mirror.py index 72544dd..92c025b 100644 --- a/conda_mirror/conda_mirror.py +++ b/conda_mirror/conda_mirror.py @@ -683,11 +683,11 @@ def main(upstream_channel, target_directory, temp_directory, platform, platform=platform, file_name=package_name) try: - _download(url, download_dir) - summary['downloaded'].add((url, download_dir)) - except: - logger.error('Unexpected error: %s. Aborting download.', sys.exc_info()[0]) - break + _download(url, download_dir) + summary['downloaded'].add((url, download_dir)) + except Exception as ex: + logger.exception('Unexpected error %s: Aborting download', ex) + break # validate all packages in the download directory validation_results = _validate_packages(packages, download_dir,