[MERGE] Catch KeyError from pwd.getpwuid(uid) [was: Re: Pulling pretty big revision...]

Robert Collins robertc at robertcollins.net
Thu Oct 30 23:21:49 GMT 2008


On Fri, 2008-10-31 at 09:52 +1100, Andrew Bennetts wrote:
> 
> 
> === modified file 'bzrlib/config.py'
> --- bzrlib/config.py    2008-10-16 18:30:32 +0000
> +++ bzrlib/config.py    2008-10-30 22:50:51 +0000
> @@ -839,7 +839,11 @@
>      try:
>          import pwd
>          uid = os.getuid()
> -        w = pwd.getpwuid(uid)
> +        try:
> +            w = pwd.getpwuid(uid)
> +        except KeyError:
> +            raise errors.BzrCommandError('Unable to determine your
> name.  '
> +               'Use "bzr whoami" to set it.')

We should explain why, so the user can debug and fix it.

-Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20081031/13dc33ac/attachment.pgp 


More information about the bazaar mailing list