public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Karl Hasselström" <kha@treskal•com>
To: Catalin Marinas <catalin.marinas@gmail•com>
Cc: git@vger•kernel.org
Subject: [StGit PATCH] Handle commandline parsing errors gracefully
Date: Sun, 20 Apr 2008 15:19:12 +0200	[thread overview]
Message-ID: <20080420131847.8824.87769.stgit@yoghurt> (raw)

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:

                 reply	other threads:[~2008-04-20 13:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080420131847.8824.87769.stgit@yoghurt \
    --to=kha@treskal$(echo .)com \
    --cc=catalin.marinas@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox