~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2007-10-10 00:21:57 UTC
  • mfrom: (2900 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2901.
  • Revision ID: mbp@sourcefrog.net-20071010002157-utci0x44m2w47wgd
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
803
803
    except (KeyboardInterrupt, Exception), e:
804
804
        # used to handle AssertionError and KeyboardInterrupt
805
805
        # specially here, but hopefully they're handled ok by the logger now
806
 
        trace.report_exception(sys.exc_info(), sys.stderr)
 
806
        exitcode = trace.report_exception(sys.exc_info(), sys.stderr)
807
807
        if os.environ.get('BZR_PDB'):
808
808
            print '**** entering debugger'
809
809
            import pdb
810
810
            pdb.post_mortem(sys.exc_traceback)
811
 
        return 3
 
811
        return exitcode
 
812
 
 
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
812
829
 
813
830
 
814
831
class HelpCommandIndex(object):