[PATCH] Zeroconf: catch both ValueError and KeyError in get()

Augie Fackler raf at durin42.com
Sat Apr 30 07:37:26 CDT 2011


Disregard this version of the patch - it incorrectly untabified the source line.

On Apr 30, 2011, at 2:35 PM, Augie Fackler wrote:
> 
> # HG changeset patch
> # User Augie Fackler <durin42 at gmail.com>
> # Date 1304166638 18000
> # Node ID ee61fc08ddfdc702548f08b0c37324fe78a29e05
> # Parent  58e58406ed190ce59c78de13e82da1f6bc47f06c
> Zeroconf: catch both ValueError and KeyError in get()
> 
> This prevents a traceback during discovery of available hosts.
> 
> diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py
> --- a/hgext/zeroconf/Zeroconf.py
> +++ b/hgext/zeroconf/Zeroconf.py
> @@ -808,7 +808,7 @@
> 		try:
> 			list = self.cache[entry.key]
> 			return list[list.index(entry)]
> -		except KeyError:
> +                except (KeyError, ValueError):
> 			return None
> 
> 	def getByDetails(self, name, type, clazz):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel




More information about the Mercurial-devel mailing list