]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Support string representation for all DNSExceptions.
authorPetr Spacek <pspacek@redhat.com>
Thu, 15 Jan 2015 16:25:10 +0000 (17:25 +0100)
committerPetr Spacek <pspacek@redhat.com>
Thu, 12 Feb 2015 11:38:30 +0000 (12:38 +0100)
Doc string is used in cases where more specific message was not provided
during instantiation/raise.

dns/exception.py

index db6ef6e6e3c495189ea25a9960b2e6e3865f296f..575cebe8952b7bfdbd43192acd9dedeea8220df1 100644 (file)
 
 class DNSException(Exception):
     """Abstract base class shared by all dnspython exceptions."""
-    pass
+    def __init__(self, *args):
+        if args:
+            super(DNSException, self).__init__(*args)
+        else:
+            # doc string is better implicit message than empty string
+            super(DNSException, self).__init__(self.__doc__)
 
 class FormError(DNSException):
     """DNS message is malformed."""