changeset 93:f537eb456cf7

svncommand: Check traceback length to stop masking real exceptions.
author Augie Fackler <durin42@gmail.com>
date Wed, 19 Nov 2008 10:16:24 -0600
parents 7486c6f6cccc
children b5651f53e7ae
files svncommand.py
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/svncommand.py
+++ b/svncommand.py
@@ -1,6 +1,8 @@
 import os
 import pickle
 import stat
+import sys
+import traceback
 
 from mercurial import hg
 from mercurial import node
@@ -37,11 +39,18 @@ def svncmd(ui, repo, subcommand, *args, 
                                            hg_repo_path=path,
                                            repo=repo,
                                            **opts)
-    except TypeError, e:
-        print e
-        print 'Bad arguments for subcommand %s' % subcommand
+    except TypeError:
+        tb = traceback.extract_tb(sys.exc_info()[2])
+        if len(tb) == 1:
+            ui.status('Bad arguments for subcommand %s\n' % subcommand)
+        else:
+            raise
     except KeyError, e:
-        print 'Unknown subcommand %s' % subcommand
+        tb = traceback.extract_tb(sys.exc_info()[2])
+        if len(tb) == 1:
+            ui.status('Unknown subcommand %s\n' % subcommand)
+        else:
+            raise
 
 @register_subcommand('help')
 def help_command(ui, args=None, **opts):