[PATCH] Convert bundle errors from Exception to BzrNewError
Aaron Bentley
aaron.bentley at utoronto.ca
Sun Aug 6 21:48:06 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hermann Kraus wrote:
> I wanted to output error messages like this:
> "bzr: ERROR: Error reading bundle: Malformed bzr revision-bundle header:
> 'Extra characters after version number'"
> So the user has at least some indication of what's wrong.
In that case, it might be good to set MalformedHeader.is_user_error to
True. Not strictly necessary, though, since I believe this is the default.
> BTW: It might
> be good to extend this message to tell the user that the problem might
> be a bundle with '\r\n' lineendings. But I'm not sure if the exception
> text is the right place to do it.
We could throw a different exception if there's a \r in the header.
>> The line you changed to give a message to MalformedHeader is more than
>> 79 character wide. It should be split and/or rewritten.
>
> I've changed this and also some other lines that were too long. Nearly
> everywhere in bundle/serializer/__init__.py lines with exception text
> were longer than 80characters.
Thank you. Those lines shouldn't have gone in as-is, and I'm partly to
blame.
>> The spacing between classes in errors.py is not consistent. There
>> should always be two blank lines between classes, and none after
>> MalformedFooter, because it's the last class in the file.
>
> Fixed.
> +class MalformedFooter(BadBundle):
> + """Malformed footer in bzr revision-bundle: %(text)r"""
> +
> + def __init__(self, text):
> + BzrNewError.__init__(self)
> + self.text = text
> \ No newline at end of file
I didn't actually mean it should have no terminating newline.
Anyhow, it gets my vote. +1.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFE1lWF0F+nu1YWqI0RAquYAJ9C/v6EKwCpx1Yiw2Hz4SvbxVj2jwCffO4e
5jiNYt8iSf9Kjv2/wiSIO9s=
=k1uW
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list