Exceptions¶
Common Exceptions¶
Common DNS Exceptions.
Dnspython modules may also define their own exceptions, which will
always be subclasses of DNSException
.
- exception dns.exception.DNSException(*args, **kwargs)[source]¶
Abstract base class shared by all dnspython exceptions.
It supports two basic modes of operation:
a) Old/compatible mode is used if
__init__
was called with empty kwargs. In compatible mode all args are passed to the standard Python Exception class as before and all args are printed by the standard__str__
implementation. Class variablemsg
(or doc string ifmsg
isNone
) is returned fromstr()
if args is empty.b) New/parametrized mode is used if
__init__
was called with non-empty kwargs. In the new mode args must be empty and all kwargs must match those set in class variablesupp_kwargs
. All kwargs are stored insideself.kwargs
and used in a new__str__
implementation to construct a formatted message based on thefmt
class variable, astring
.In the simplest case it is enough to override the
supp_kwargs
andfmt
class variables to get nice parametrized messages.
dns.dnssec Exceptions¶
dns.message Exceptions¶
- exception dns.message.BadEDNS(*args, **kwargs)[source]¶
An OPT record occurred somewhere other than the additional data section.
- exception dns.message.BadTSIG(*args, **kwargs)[source]¶
A TSIG record occurred somewhere other than the end of the additional data section.
- exception dns.message.ShortHeader(*args, **kwargs)[source]¶
The DNS packet passed to from_wire() is too short.
- exception dns.message.TrailingJunk(*args, **kwargs)[source]¶
The DNS packet passed to from_wire() has extra junk at the end of it.
dns.name Exceptions¶
- exception dns.name.AbsoluteConcatenation(*args, **kwargs)[source]¶
An attempt was made to append anything other than the empty name to an absolute DNS name.
- exception dns.name.BadEscape(*args, **kwargs)[source]¶
An escaped code in a text format of DNS name is invalid.
- exception dns.name.BadLabelType(*args, **kwargs)[source]¶
The label type in DNS name wire format is unknown.
- exception dns.name.BadPointer(*args, **kwargs)[source]¶
A DNS compression pointer points forward instead of backward.
- exception dns.name.NeedAbsoluteNameOrOrigin(*args, **kwargs)[source]¶
An attempt was made to convert a non-absolute name to wire when there was also a non-absolute (or missing) origin.
dns.opcode Exceptions¶
dns.query Exceptions¶
- exception dns.query.BadResponse(*args, **kwargs)[source]¶
A DNS query response does not respond to the question asked.
- exception dns.query.NoDOH(*args, **kwargs)[source]¶
DNS over HTTPS (DOH) was requested but the httpx module is not available.
dns.rcode Exceptions¶
dns.rdataset Exceptions¶
dns.resolver Exceptions¶
- exception dns.resolver.NoAnswer(*args, **kwargs)[source]¶
The DNS response does not contain an answer to the question.
- exception dns.resolver.NoNameservers(*args, **kwargs)[source]¶
All nameservers failed to answer the query.
errors: list of servers and respective errors The type of errors is [(server IP address, any object convertible to string)]. Non-empty errors list will add explanatory message ()
- exception dns.resolver.NoRootSOA(*args, **kwargs)[source]¶
There is no SOA RR at the DNS root name. This should never happen!