chiark / gitweb /
Add EditorException to stgit/utils.py
authorCatalin Marinas <catalin.marinas@gmail.com>
Wed, 28 Feb 2007 08:41:56 +0000 (08:41 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Wed, 28 Feb 2007 08:41:56 +0000 (08:41 +0000)
The patch adds the stgit.main.main handling of this exception as well.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/main.py
stgit/utils.py

index f77fba846501fc6ce15e393854172d00cf0affe8..9fcbbc2bff88fc0ab0de41b5670ebf659fb99476 100644 (file)
@@ -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
index d7d4777e23c7850ec02ea8172a27a0eb0ee4973c..bfe77978f05ed5f64feed32b036605a1488cf484 100644 (file)
@@ -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'