From 4d565525a96f6b64b6f447d817267dfd8f192990 Mon Sep 17 00:00:00 2001 From: Augie Fackler Date: Wed, 19 Nov 2008 10:16:24 -0600 Subject: [PATCH] svncommand: Check traceback length to stop masking real exceptions. --- svncommand.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/svncommand.py b/svncommand.py index 0361c716a6..caf15b7917 100644 --- 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, **opts): 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):