* [StGit PATCH] Handle commandline parsing errors gracefully
@ 2008-04-20 13:19 Karl Hasselström
0 siblings, 0 replies; only message in thread
From: Karl Hasselström @ 2008-04-20 13:19 UTC (permalink / raw)
To: Catalin Marinas; +Cc: git
The commandline option parser raises SystemExit after having explained
to the user what she did wrong. A recent refactoring introduced a
catch-all "except:" at the top level, which caught the SystemExit and
printed a traceback.
Let's just simply exit instead, like we used to.
Signed-off-by: Karl Hasselström <kha@treskal.com>
---
This goes on the "master" branch.
stgit/main.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/stgit/main.py b/stgit/main.py
index 663fdec..aa1f8ef 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -281,6 +281,10 @@ def main():
if debug_level > 0:
traceback.print_exc()
sys.exit(utils.STGIT_COMMAND_ERROR)
+ except SystemExit:
+ # Triggered by the option parser when it finds bad commandline
+ # parameters.
+ sys.exit(utils.STGIT_COMMAND_ERROR)
except KeyboardInterrupt:
sys.exit(utils.STGIT_GENERAL_ERROR)
except:
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-04-20 13:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-20 13:19 [StGit PATCH] Handle commandline parsing errors gracefully Karl Hasselström
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).