More error-proofing

This commit is contained in:
Geoffrey Frogeye 2019-11-10 23:07:21 +01:00
parent 0801bd9e44
commit c409c2cf9b

View file

@ -37,6 +37,9 @@ def is_subdomain_matching(subdomain: str) -> bool:
except dns.exception.Timeout: except dns.exception.Timeout:
print(f"Timeout for {subdomain}", file=sys.stderr) print(f"Timeout for {subdomain}", file=sys.stderr)
return False return False
except dns.name.EmptyLabel:
print(f"Empty label for {subdomain}", file=sys.stderr)
return False
canonical = query.canonical_name.to_text() canonical = query.canonical_name.to_text()
for regex in regexes.REGEXES: for regex in regexes.REGEXES:
if re.match(regex, canonical): if re.match(regex, canonical):