# HG changeset patch # User Javi Merino # Date 1277282753 -7200 # Node ID 7c58cde598fefd804f31da076e745696f792a2da # Parent 86eea1f97eac0dfa6874c5066cf4d8454f5d3c8f zeroconf: Use BadDomainName exception instead of string exceptions String exceptions no longer work in python 2.6. Use exception classes instead. diff -r 86eea1f97eac -r 7c58cde598fe hgext/zeroconf/Zeroconf.py --- a/hgext/zeroconf/Zeroconf.py Wed Jun 23 11:53:59 2010 +0200 +++ b/hgext/zeroconf/Zeroconf.py Wed Jun 23 10:45:53 2010 +0200 @@ -204,6 +204,13 @@ class BadTypeInNameException(Exception): pass +class BadDomainName(Exception): + def __init__(self, pos): + Exception.__init__(self, "at position %s" % pos) + +class BadDomainNameCircular(BadDomainName): + pass + # implementation classes class DNSEntry(object): @@ -598,10 +605,10 @@ next = off + 1 off = ((len & 0x3F) << 8) | ord(self.data[off]) if off >= first: - raise "Bad domain name (circular) at " + str(off) + raise BadDomainNameCircular(off) first = off else: - raise "Bad domain name at " + str(off) + raise BadDomainName(off) if next >= 0: self.offset = next