[BUG] improve error messages
John A Meinel
john at arbash-meinel.com
Wed Sep 14 12:02:59 BST 2005
Jari Aalto wrote:
> any operation that is tried on directory which does not contain ./.bzr
> directory now results (I tried mistakenly 'add'):
>
> bzr: ERROR: /cygdrive/e/home/jaalto/tmp/vc/bzr/2 is not in a branch
> at /usr/src/build/build/bazaar-ng/bzr-0.0.7/.inst/usr/share/lib/python2.4/site-packages/bzrlib/branch.py line 131, in find_branch_root()
>
> Could the error handling be improved a little so that it would first
> check the existence of ./.bzr and say:
>
> $ bzr add
> bzr: ERROR: Directory is not bzr controlled (no .bzr/ found; run bzr init)
>
> Jari
>
>
>
Well, at the very least, it has to search up the tree. But probably the
error thrown should be BzrCommandError so that it doesn't default to
printing out the backtrace.
But I think the statement:
bzr: ERROR: /Users/jameinel/,tmp is not in a branch
Is the same thing as saying "Directory is not bzr controlled", though
maybe not as obviously. Remember, in bzr there is only 1 control
directory, not like CVS (and I believe svn) where they put a control dir
in *every* dir.
I just checked, and it is throwing NotBranchError, which is a
specialized exception inherited from BzrError (where tracebacks are
printed). Doing the simple "Inherit from BzrCommandError" did indeed
remove the traceback. But is NotBranchError always be a simple user
error? I'm guessing in some places it is there to trap for real errors.
So what about find_branch_root(), should it ever print a traceback? My
personal feeling is it shouldn't print a traceback whenever it is called
from a cmd_*.run() function, since that indicates that a user specified
the name directly. But if it is deeper in the core, then it is harder to
say, since it might indicate a bug.
I guess I would change find_branch_root() so that it throws a
BzrCommandError.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050914/87cac9c0/attachment.pgp
More information about the bazaar
mailing list