From b3ae3e141a388b9c17c0abab70812dcdab512a05 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Wed, 28 Feb 2007 08:41:56 +0000 Subject: [PATCH] Add EditorException to stgit/utils.py The patch adds the stgit.main.main handling of this exception as well. Signed-off-by: Catalin Marinas --- stgit/main.py | 4 +++- stgit/utils.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/stgit/main.py b/stgit/main.py index f77fba8..9fcbbc2 100644 --- a/stgit/main.py +++ b/stgit/main.py @@ -256,6 +256,7 @@ def main(): from stgit.git import GitException from stgit.commands.common import CmdException from stgit.gitmergeonefile import GitMergeException + from stgit.utils import EditorException try: debug_level = int(os.environ['STGIT_DEBUG_LEVEL']) @@ -279,7 +280,8 @@ def main(): command.func(parser, options, args) except (IOError, ParsingError, NoSectionError, CmdException, - StackException, GitException, GitMergeException), err: + StackException, GitException, GitMergeException, + EditorException), err: print >> sys.stderr, '%s %s: %s' % (prog, cmd, err) if debug_level: raise diff --git a/stgit/utils.py b/stgit/utils.py index d7d4777..bfe7797 100644 --- a/stgit/utils.py +++ b/stgit/utils.py @@ -154,6 +154,9 @@ def rename(basedir, file1, file2): os.rename(os.path.join(basedir, file1), full_file2) remove_dirs(basedir, os.path.dirname(file1)) +class EditorException(Exception): + pass + def call_editor(filename): """Run the editor on the specified filename.""" @@ -171,5 +174,5 @@ def call_editor(filename): sys.stdout.flush() err = os.system(editor) if err: - raise Exception, 'editor failed, exit code: %d' % err + raise EditorException, 'editor failed, exit code: %d' % err print 'done' -- 2.11.0