diff options
| author | Petr Spacek <pspacek@redhat.com> | 2015-01-15 17:25:10 +0100 |
|---|---|---|
| committer | Petr Spacek <pspacek@redhat.com> | 2015-02-12 12:34:14 +0100 |
| commit | a4bdb7113dba8ed819d8454a1e8f2916ee33d9a6 (patch) | |
| tree | 41b30d49f8ad1308a6a1c61032afdd191def818c /dns/exception.py | |
| parent | 43c14fd73b3b94211ff8bfad8f894b48cce4e577 (diff) | |
| download | dnspython-a4bdb7113dba8ed819d8454a1e8f2916ee33d9a6.tar.gz | |
Support string representation for all DNSExceptions.
Doc string is used in cases where more specific message was not provided
during instantiation/raise.
Diffstat (limited to 'dns/exception.py')
| -rw-r--r-- | dns/exception.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/dns/exception.py b/dns/exception.py index db6ef6e..575cebe 100644 --- a/dns/exception.py +++ b/dns/exception.py @@ -17,7 +17,12 @@ 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.""" |
