Skip to content
Snippets Groups Projects
Commit c24f9772 authored by Alan De Smet's avatar Alan De Smet
Browse files

Never catch all exceptions

It was eaching KeyboardInterrupt and causing me grief.
(A small exception is granted for a case that does cleanup and re-raises
te exception.)
parent 49657ebe
Branches
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@ def logprogress(msg):
try:
logging.progress(msg)
return
except:
except Exception:
pass
logging.info(msg)
......@@ -367,7 +367,7 @@ def download_all(url_to_dst, download_stats, do_download, timeout):
download_to_file_no_lock(url, path, file, timeout)
download_successful("download_all success", path, atomic.final_size(), download_stats)
except:
except: # We're going to re-raise the exception.
# Files present at start should not be in todo, so this is just
# stuff we might have downloaded. Wipe it out, as it's all or
# nothing
......@@ -838,7 +838,7 @@ class Downloader:
try:
logging.debug("Data set successfully acquired. Problems encountered and resolved:")
dump_problems(logging.debug, problems)
except:
except Exception:
# Don't cause grief over logging problems here
# since any exceptions will retry downloads
# when we already have the files!
......@@ -859,7 +859,7 @@ class Downloader:
try:
first = problems[0][0]
except:
except IndexError:
first = ""
raise DownloadsFailedException("Errors occurred during download, including "+first)
......@@ -940,7 +940,7 @@ class Downloader:
try:
self.download_first_available(filesets, dst, timeout=timeout, retries=1, retry_wait=1, download_stats = download_stats)
except:
except Exception:
# We just keep trucking on; missed files are unfortunate,
# but not much we can do.
pass
......
......@@ -74,7 +74,7 @@ class ExclusiveLockFile:
self.file = None
self.filename = filename_or_file
logger.debug(f"ExclusiveLockFile({filename_or_file}) is path-like")
except:
except Exception:
# Not Path-like? I hope it's file-like
self.file = filename_or_file
self.filename = None
......@@ -233,7 +233,7 @@ def unlink_if_possible(filename):
try:
os.unlink(filename)
return True
except:
except OSError:
return False
class AtomicCreateIfMissing:
......
......@@ -42,11 +42,11 @@ def roundtozero(value, step = None, offset = None):
"""
try:
if step is None: step = type(value)(1)
except:
except Exception:
raise ValueError("roundtozero: Unable to construct a default step using type(value)(1); you'll need to pass step is explicitly.")
try:
if offset is None: offset = type(value)()
except:
except Exception:
raise ValueError("roundtozero: Unable to construct a default step using type(value)(); you'll need to pass step is explicitly.")
offset_value = value - offset
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment