~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Aaron Bentley
  • Date: 2005-09-14 16:54:44 UTC
  • mto: (1185.1.16)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: abentley@panoramicfeedback.com-20050914165444-335a16dc80f7c129
Handled NotBranchError like a CommandError in main()

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
import bzrlib
35
35
import bzrlib.trace
36
36
from bzrlib.trace import mutter, note, log_error, warning
37
 
from bzrlib.errors import BzrError, BzrCheckError, BzrCommandError
 
37
from bzrlib.errors import BzrError, BzrCheckError, BzrCommandError, NotBranchError
38
38
from bzrlib.branch import find_branch
39
39
from bzrlib import BZRDIR
40
40
 
651
651
 
652
652
    try:
653
653
        try:
654
 
            return run_bzr(argv[1:])
655
 
        finally:
656
 
            # do this here inside the exception wrappers to catch EPIPE
657
 
            sys.stdout.flush()
 
654
            try:
 
655
                return run_bzr(argv[1:])
 
656
            finally:
 
657
                # do this here inside the exception wrappers to catch EPIPE
 
658
                sys.stdout.flush()
 
659
        #wrap common errors as CommandErrors.
 
660
        except (NotBranchError,), e:
 
661
            raise BzrCommandError(str(e))
658
662
    except BzrCommandError, e:
659
663
        # command line syntax error, etc
660
664
        log_error(str(e))