From: Bob Halley Date: Tue, 26 Oct 2021 01:04:56 +0000 (-0700) Subject: Distinguish between the two causes of NoResolverConfiguration in the exception string X-Git-Tag: v2.2.0rc1~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef9826268ee9b2112fe0f8f26eb90496de5d4158;p=thirdparty%2Fdnspython.git Distinguish between the two causes of NoResolverConfiguration in the exception string --- diff --git a/dns/resolver.py b/dns/resolver.py index 08e9e617..108dd52d 100644 --- a/dns/resolver.py +++ b/dns/resolver.py @@ -807,7 +807,7 @@ class BaseResolver: f = stack.enter_context(open(f)) except OSError: # /etc/resolv.conf doesn't exist, can't be read, etc. - raise NoResolverConfiguration + raise NoResolverConfiguration(f'cannot open {f}') for l in f: if len(l) == 0 or l[0] == '#' or l[0] == ';': @@ -848,7 +848,7 @@ class BaseResolver: except (ValueError, IndexError): pass if len(self.nameservers) == 0: - raise NoResolverConfiguration + raise NoResolverConfiguration('no nameservers') def _determine_split_char(self, entry): #