]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/python | |
2 | ############################################################################### | |
3 | # # | |
4 | # ddns - A dynamic DNS client for IPFire # | |
5 | # Copyright (C) 2012 IPFire development team # | |
6 | # # | |
7 | # This program is free software: you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation, either version 3 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # This program is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
19 | # # | |
20 | ############################################################################### | |
21 | ||
22 | N_ = lambda x: x | |
23 | ||
24 | class DDNSError(Exception): | |
25 | """ | |
26 | Generic error class for all exceptions | |
27 | raised by DDNS. | |
28 | """ | |
29 | reason = N_("Error") | |
30 | ||
31 | def __init__(self, message=None): | |
32 | self.message = message | |
33 | ||
34 | ||
35 | class DDNSNetworkError(DDNSError): | |
36 | """ | |
37 | Thrown when a network error occured. | |
38 | """ | |
39 | reason = N_("Network error") | |
40 | ||
41 | ||
42 | class DDNSAbuseError(DDNSError): | |
43 | """ | |
44 | Thrown when the server reports | |
45 | abuse for this account. | |
46 | """ | |
47 | reason = N_("The server denied processing the request because account abuse is suspected") | |
48 | ||
49 | ||
50 | class DDNSAuthenticationError(DDNSError): | |
51 | """ | |
52 | Thrown when the server did not | |
53 | accept the user credentials. | |
54 | """ | |
55 | reason = N_("Authentication against the server has failed") | |
56 | ||
57 | ||
58 | class DDNSBlockedError(DDNSError): | |
59 | """ | |
60 | Thrown when the dynamic update client | |
61 | (specified by the user-agent) has been blocked | |
62 | by a dynamic DNS provider. | |
63 | """ | |
64 | reason = N_("The server denies any updates from this client") | |
65 | ||
66 | ||
67 | class DDNSCertificateError(DDNSError): | |
68 | """ | |
69 | Thrown when a server presented an invalid certificate. | |
70 | """ | |
71 | reason = N_("Invalid certificate") | |
72 | ||
73 | ||
74 | class DDNSConfigurationError(DDNSError): | |
75 | """ | |
76 | Thrown when invalid or insufficient | |
77 | data is provided by the configuration file. | |
78 | """ | |
79 | reason = N_("The configuration file has errors") | |
80 | ||
81 | ||
82 | class DDNSConnectionRefusedError(DDNSNetworkError): | |
83 | """ | |
84 | Thrown when a connection is refused. | |
85 | """ | |
86 | reason = N_("Connection refused") | |
87 | ||
88 | ||
89 | class DDNSConnectionTimeoutError(DDNSNetworkError): | |
90 | """ | |
91 | Thrown when a connection to a server has timed out. | |
92 | """ | |
93 | reason = N_("Connection timeout") | |
94 | ||
95 | ||
96 | class DDNSHostNotFoundError(DDNSError): | |
97 | """ | |
98 | Thrown when a configuration entry could | |
99 | not be found. | |
100 | """ | |
101 | reason = N_("The host could not be found in the configuration file") | |
102 | ||
103 | ||
104 | class DDNSInternalServerError(DDNSError): | |
105 | """ | |
106 | Thrown when the remote server reported | |
107 | an error on the provider site. | |
108 | """ | |
109 | reason = N_("Internal server error") | |
110 | ||
111 | ||
112 | class DDNSNetworkUnreachableError(DDNSNetworkError): | |
113 | """ | |
114 | Thrown when a network is not reachable. | |
115 | """ | |
116 | reason = N_("Network unreachable") | |
117 | ||
118 | ||
119 | class DDNSNoRouteToHostError(DDNSNetworkError): | |
120 | """ | |
121 | Thrown when there is no route to a host. | |
122 | """ | |
123 | reason = N_("No route to host") | |
124 | ||
125 | ||
126 | class DDNSNotFound(DDNSError): | |
127 | """ | |
128 | Thrown when the called URL has not been found | |
129 | """ | |
130 | reason = N_("Not found") | |
131 | ||
132 | ||
133 | class DDNSRequestError(DDNSError): | |
134 | """ | |
135 | Thrown when a request could | |
136 | not be properly performed. | |
137 | """ | |
138 | reason = N_("Request error") | |
139 | ||
140 | ||
141 | class DDNSResolveError(DDNSNetworkError): | |
142 | """ | |
143 | Thrown when a DNS record could not be resolved | |
144 | because of a local error. | |
145 | """ | |
146 | reason = N_("Could not resolve DNS entry") | |
147 | ||
148 | ||
149 | class DDNSSSLError(DDNSNetworkError): | |
150 | """ | |
151 | Raised when a SSL connection could not be | |
152 | negotiated. | |
153 | """ | |
154 | reason = N_("SSL negotiation error") | |
155 | ||
156 | ||
157 | class DDNSServiceUnavailableError(DDNSNetworkError): | |
158 | """ | |
159 | Equivalent to HTTP error code 503. | |
160 | """ | |
161 | reason = N_("Service unavailable") | |
162 | ||
163 | ||
164 | class DDNSUpdateError(DDNSError): | |
165 | """ | |
166 | Thrown when an update could not be | |
167 | properly performed. | |
168 | """ | |
169 | reason = N_("The update could not be performed") |