From 145e35b805957487601514481df23b8fb723be38 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Wed, 12 Feb 2020 15:40:47 +0900 Subject: Fix usage of bare 'except' flake8 reports: E722 do not use bare 'except' Replace them with 'except Exception' per [1] which says: Bare except will catch exceptions you almost certainly don't want to catch, including KeyboardInterrupt (the user hitting Ctrl+C) and Python-raised errors like SystemExit If you don't have a specific exception you're expecting, at least except Exception, which is the base type for all "Regular" exceptions. [1] https://stackoverflow.com/a/54948581 Change-Id: Ic555ea9482645899f5b04040ddb6b24eadbf9062 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254606 Reviewed-by: Mike Frysinger Tested-by: David Pursehouse --- project.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'project.py') diff --git a/project.py b/project.py index 372421cf..016f4a53 100644 --- a/project.py +++ b/project.py @@ -2619,7 +2619,7 @@ class Project(object): (self.worktree)): platform_utils.rmtree(platform_utils.realpath(self.worktree)) return self._InitGitDir(mirror_git=mirror_git, force_sync=False) - except: + except Exception: raise e raise e @@ -2864,7 +2864,7 @@ class Project(object): try: platform_utils.rmtree(dotgit) return self._InitWorkTree(force_sync=False, submodules=submodules) - except: + except Exception: raise e raise e -- cgit v1.2.3-54-g00ecf