aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Twisted/py2/twisted/names/error.py
blob: 92a076b26e1d9a2bea9e19834507dee8cd02f33b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# -*- test-case-name: twisted.names.test -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

"""
Exception class definitions for Twisted Names.
"""

from __future__ import division, absolute_import

from twisted.internet.defer import TimeoutError


class DomainError(ValueError):
    """
    Indicates a lookup failed because there were no records matching the given
    C{name, class, type} triple.
    """



class AuthoritativeDomainError(ValueError):
    """
    Indicates a lookup failed for a name for which this server is authoritative
    because there were no records matching the given C{name, class, type}
    triple.
    """



class DNSQueryTimeoutError(TimeoutError):
    """
    Indicates a lookup failed due to a timeout.

    @ivar id: The id of the message which timed out.
    """
    def __init__(self, id):
        TimeoutError.__init__(self)
        self.id = id



class DNSFormatError(DomainError):
    """
    Indicates a query failed with a result of C{twisted.names.dns.EFORMAT}.
    """



class DNSServerError(DomainError):
    """
    Indicates a query failed with a result of C{twisted.names.dns.ESERVER}.
    """



class DNSNameError(DomainError):
    """
    Indicates a query failed with a result of C{twisted.names.dns.ENAME}.
    """



class DNSNotImplementedError(DomainError):
    """
    Indicates a query failed with a result of C{twisted.names.dns.ENOTIMP}.
    """



class DNSQueryRefusedError(DomainError):
    """
    Indicates a query failed with a result of C{twisted.names.dns.EREFUSED}.
    """



class DNSUnknownError(DomainError):
    """
    Indicates a query failed with an unknown result.
    """



class ResolverError(Exception):
    """
    Indicates a query failed because of a decision made by the local
    resolver object.
    """


__all__ = [
    'DomainError', 'AuthoritativeDomainError', 'DNSQueryTimeoutError',

    'DNSFormatError', 'DNSServerError', 'DNSNameError',
    'DNSNotImplementedError', 'DNSQueryRefusedError',
    'DNSUnknownError', 'ResolverError']