Initial import to Tizen
[profile/ivi/python-twisted.git] / twisted / names / error.py
1 # -*- test-case-name: twisted.names.test -*-
2 # Copyright (c) Twisted Matrix Laboratories.
3 # See LICENSE for details.
4
5 """
6 Exception class definitions for Twisted Names.
7 """
8
9 from twisted.internet.defer import TimeoutError
10
11
12 class DomainError(ValueError):
13     """
14     Indicates a lookup failed because there were no records matching the given
15     C{name, class, type} triple.
16     """
17
18
19
20 class AuthoritativeDomainError(ValueError):
21     """
22     Indicates a lookup failed for a name for which this server is authoritative
23     because there were no records matching the given C{name, class, type}
24     triple.
25     """
26
27
28
29 class DNSQueryTimeoutError(TimeoutError):
30     """
31     Indicates a lookup failed due to a timeout.
32
33     @ivar id: The id of the message which timed out.
34     """
35     def __init__(self, id):
36         TimeoutError.__init__(self)
37         self.id = id
38
39
40
41 class DNSFormatError(DomainError):
42     """
43     Indicates a query failed with a result of L{twisted.names.dns.EFORMAT}.
44     """
45
46
47
48 class DNSServerError(DomainError):
49     """
50     Indicates a query failed with a result of L{twisted.names.dns.ESERVER}.
51     """
52
53
54
55 class DNSNameError(DomainError):
56     """
57     Indicates a query failed with a result of L{twisted.names.dns.ENAME}.
58     """
59
60
61
62 class DNSNotImplementedError(DomainError):
63     """
64     Indicates a query failed with a result of L{twisted.names.dns.ENOTIMP}.
65     """
66
67
68
69 class DNSQueryRefusedError(DomainError):
70     """
71     Indicates a query failed with a result of L{twisted.names.dns.EREFUSED}.
72     """
73
74
75
76 class DNSUnknownError(DomainError):
77     """
78     Indicates a query failed with an unknown result.
79     """
80
81
82
83 class ResolverError(Exception):
84     """
85     Indicates a query failed because of a decision made by the local
86     resolver object.
87     """
88
89
90 __all__ = [
91     'DomainError', 'AuthoritativeDomainError', 'DNSQueryTimeoutError',
92
93     'DNSFormatError', 'DNSServerError', 'DNSNameError',
94     'DNSNotImplementedError', 'DNSQueryRefusedError',
95     'DNSUnknownError', 'ResolverError']