~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2007-09-18 05:35:31 UTC
  • mto: (2830.2.10 test-traceback)
  • mto: This revision was merged to the branch mainline in revision 2874.
  • Revision ID: mbp@sourcefrog.net-20070918053531-hwrmyg05y3az3xcx
If TestCase.run_bzr hits an internal exception, don't catch it but rather propagate up into the test suite

Show diffs side-by-side

added added

removed removed

Lines of Context:
811
811
        return 3
812
812
 
813
813
 
 
814
def run_bzr_catch_user_errors(argv):
 
815
    """Run bzr and report user errors, but let internal errors propagate.
 
816
 
 
817
    This is used for the test suite, and might be useful for other programs
 
818
    that want to wrap the commandline interface.
 
819
    """
 
820
    try:
 
821
        return run_bzr(argv)
 
822
    except Exception, e:
 
823
        if (isinstance(e, (OSError, IOError))
 
824
            or not getattr(e, 'internal_error', True)):
 
825
            trace.report_exception(sys.exc_info(), sys.stderr)
 
826
            return 3
 
827
        else:
 
828
            raise
 
829
 
 
830
 
814
831
class HelpCommandIndex(object):
815
832
    """A index for bzr help that returns commands."""
816
833