mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-15 20:01:03 +00:00
exception syntax
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@2308 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
9560ad55ec
commit
b20cd18280
2 changed files with 8 additions and 8 deletions
|
|
@ -108,10 +108,10 @@ class Answer(object):
|
|||
break
|
||||
continue
|
||||
except KeyError:
|
||||
raise NoAnswer("DNS response had no answer")
|
||||
raise NoAnswer("DNS response had no answer")
|
||||
raise NoAnswer, "DNS response had no answer"
|
||||
raise NoAnswer, "DNS response had no answer"
|
||||
if rrset is None:
|
||||
raise NoAnswer("DNS response had no answer")
|
||||
raise NoAnswer, "DNS response had no answer"
|
||||
self.rrset = rrset
|
||||
self.expiration = time.time() + min_ttl
|
||||
|
||||
|
|
@ -555,15 +555,15 @@ class Resolver(object):
|
|||
nameservers = self.nameservers[:]
|
||||
while response is None:
|
||||
if len(nameservers) == 0:
|
||||
raise NoNameservers("No DNS servers could answer the query")
|
||||
raise NoNameservers, "No DNS servers could answer the query"
|
||||
for nameserver in nameservers:
|
||||
now = time.time()
|
||||
if now < start:
|
||||
# Time going backwards is bad. Just give up.
|
||||
raise Timeout("DNS query timed out")
|
||||
raise Timeout, "DNS query timed out"
|
||||
duration = now - start
|
||||
if duration >= self.lifetime:
|
||||
raise Timeout("DNS query timed out")
|
||||
raise Timeout, "DNS query timed out"
|
||||
timeout = min(self.lifetime - duration, self.timeout)
|
||||
try:
|
||||
if tcp:
|
||||
|
|
@ -604,7 +604,7 @@ class Resolver(object):
|
|||
all_nxdomain = False
|
||||
break
|
||||
if all_nxdomain:
|
||||
raise NXDOMAIN("Domain does not exist")
|
||||
raise NXDOMAIN, "Domain does not exist"
|
||||
answer = Answer(qname, rdtype, rdclass, response)
|
||||
if self.cache:
|
||||
self.cache.put((qname, rdtype, rdclass), answer)
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ class Tokenizer(object):
|
|||
self._unget_char(c)
|
||||
return skipped
|
||||
skipped += 1
|
||||
raise AssertionError("skip_whitespace() broke endless loop")
|
||||
raise AssertionError, "skip_whitespace() broke endless loop"
|
||||
|
||||
def get(self, want_leading = False, want_comment = False):
|
||||
"""Get the next token.
|
||||
|
|
|
|||
Loading…
Reference in a new issue