diff options
author | David Pursehouse <dpursehouse@collab.net> | 2020-02-12 15:40:47 +0900 |
---|---|---|
committer | David Pursehouse <dpursehouse@collab.net> | 2020-02-12 06:49:25 +0000 |
commit | 145e35b805957487601514481df23b8fb723be38 (patch) | |
tree | d8d932f32782e485d9b95fb4d104d1427bce5981 /project.py | |
parent | 819827a42ddb364f98c3a1a7eae2536dc54bc4cc (diff) | |
download | git-repo-145e35b805957487601514481df23b8fb723be38.tar.gz |
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 <vapier@google.com>
Tested-by: David Pursehouse <dpursehouse@collab.net>
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2619,7 +2619,7 @@ class Project(object): | |||
2619 | (self.worktree)): | 2619 | (self.worktree)): |
2620 | platform_utils.rmtree(platform_utils.realpath(self.worktree)) | 2620 | platform_utils.rmtree(platform_utils.realpath(self.worktree)) |
2621 | return self._InitGitDir(mirror_git=mirror_git, force_sync=False) | 2621 | return self._InitGitDir(mirror_git=mirror_git, force_sync=False) |
2622 | except: | 2622 | except Exception: |
2623 | raise e | 2623 | raise e |
2624 | raise e | 2624 | raise e |
2625 | 2625 | ||
@@ -2864,7 +2864,7 @@ class Project(object): | |||
2864 | try: | 2864 | try: |
2865 | platform_utils.rmtree(dotgit) | 2865 | platform_utils.rmtree(dotgit) |
2866 | return self._InitWorkTree(force_sync=False, submodules=submodules) | 2866 | return self._InitWorkTree(force_sync=False, submodules=submodules) |
2867 | except: | 2867 | except Exception: |
2868 | raise e | 2868 | raise e |
2869 | raise e | 2869 | raise e |
2870 | 2870 | ||