]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Distinguish between the two causes of NoResolverConfiguration in the exception string
authorBob Halley <halley@dnspython.org>
Tue, 26 Oct 2021 01:04:56 +0000 (18:04 -0700)
committerBob Halley <halley@dnspython.org>
Tue, 26 Oct 2021 01:05:31 +0000 (18:05 -0700)
dns/resolver.py

index 08e9e6179332d80b0401e01bfc591f8825e82ee0..108dd52db8b926ec804cd26b57e381b86669160c 100644 (file)
@@ -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):
         #