[MERGE] dont stacktrace on bad plugin versions
Forest Bond
forest at alittletooquiet.net
Thu Oct 16 00:48:18 BST 2008
Hi,
On Thu, Oct 16, 2008 at 01:34:17AM +0200, Marius Kruger wrote:
> === modified file 'bzrlib/plugin.py'
> --- bzrlib/plugin.py 2008-10-07 06:41:46 +0000
> +++ bzrlib/plugin.py 2008-10-15 21:48:10 +0000
> @@ -41,6 +41,7 @@
> import zipfile
>
> from bzrlib import (
> + _format_version_tuple,
> config,
> debug,
> errors,
> @@ -457,12 +458,14 @@
>
> def _get__version__(self):
> version_info = self.version_info()
> - if version_info is None:
> + if version_info is None or len(version_info) == 0:
> return "unknown"
> - if version_info[3] == 'final':
> - version_string = '%d.%d.%d' % version_info[:3]
> - else:
> - version_string = '%d.%d.%d%s%d' % version_info
> + try:
> + version_string = _format_version_tuple(version_info)
> + except:
> + # try to return something usefull for bad plugins, in stead of
> + # stack tracing.
> + version_string = '.'.join(map(str, version_info))
This will mask other exceptions, including KeyboardInterrupt. Should you
specify which exceptions you may be expecting?
Thanks,
Forest
--
Forest Bond
http://www.alittletooquiet.net
http://www.pytagsfs.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20081015/367cbb22/attachment.pgp
More information about the bazaar
mailing list