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

Augie Fackler durin42 at gmail.com
Sat Apr 30 07:35:13 CDT 2011


# 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):


More information about the Mercurial-devel mailing list