dns :: exception :: DNSException :: Class DNSException |
[hide private]
[frames] | no frames]

# Class DNSException

source code

                  object --+
                           |
    exceptions.BaseException --+
                               |
            exceptions.Exception --+
                                   |
                                  DNSException

Known Subclasses:
  - dnssec.UnsupportedAlgorithm
  - , dnssec.ValidationFailure
  - , FormError
  - , SyntaxError
  - , Timeout
  - , TooBig
  - , message.UnknownHeaderField
  - , message.UnknownTSIGKey
  - , name.AbsoluteConcatenation
  - , name.IDNAException
  - , name.NeedAbsoluteNameOrOrigin
  - , name.NoIDNA2008
  - , name.NoParent
  - , opcode.UnknownOpcode
  - , query.UnexpectedSource
  - , rcode.UnknownRcode
  - , rdataclass.UnknownRdataclass
  - , rdataset.DifferingCovers
  - , rdataset.IncompatibleTypes
  - , rdatatype.UnknownRdatatype
  - , resolver.NXDOMAIN
  - , resolver.NoAnswer
  - , resolver.NoMetaqueries
  - , resolver.NoNameservers
  - , resolver.NoRootSOA
  - , resolver.NotAbsolute
  - , resolver.YXDOMAIN
  - , tokenizer.UngetBufferFull
  - , tsig.BadSignature
  - , tsig.BadTime
  - , tsig.PeerError
  - , zone.BadZone
  - , rdtypes.ANY.RRSIG.BadSigTime

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 standard Python Exception class as before and all *args are printed by standard __str__ implementation. Class variable msg (or doc string if msg is None) is returned from str() if *args is empty.

b) New/parametrized mode is used if __init__ was called with non-empty **kwargs. In the new mode *args has to be empty and all kwargs has to exactly match set in class variable self.supp_kwargs. All kwargs are stored inside self.kwargs and used in new __str__ implementation to construct formatted message based on self.fmt string.

In the simplest case it is enough to override supp_kwargs and fmt class variables to get nice parametrized messages.

Instance Methods | [hide private]
__init__(self, *args, **kwargs) x.__init__(...) initializes x; see help(type(x)) for signature | source code
__str__(self) str(x) | source code
_check_kwargs(self, **kwargs) | source code
_check_params(self, *args, **kwargs) Old exceptions supported only args and not kwargs. | source code
_fmt_kwargs(self, **kwargs) Format kwargs before printing them. | source code
Inherited from `exceptions.Exception`: `__new__` Inherited from `exceptions.BaseException`: `__delattr__`, `__getattribute__`, `__getitem__`, `__getslice__`, `__reduce__`, `__repr__`, `__setattr__`, `__setstate__`, `__unicode__` Inherited from `object`: `__format__`, `__hash__`, `__reduce_ex__`, `__sizeof__`, `__subclasshook__`

Class Variables | [hide private]
| fmt = `None` hash(x)
| msg = `None` hash(x)
| supp_kwargs = ``set([``])``

Properties | [hide private]
Inherited from `exceptions.BaseException`: `args`, `message` Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, *args, **kwargs) (Constructor) | source code
x.__init__(...) initializes x; see help(type(x)) for signature Overrides: object.__init__ (inherited documentation)

### __str__(self) (Informal representation operator) | source code
str(x) Overrides: object.__str__ (inherited documentation)

### _check_params(self, *args, **kwargs) | source code
Old exceptions supported only args and not kwargs. For sanity we do not allow to mix old and new behavior.

### _fmt_kwargs(self, **kwargs) | source code
Format kwargs before printing them. Resulting dictionary has to have keys necessary for str.format call on fmt class variable.