]>
Commit | Line | Data |
---|---|---|
f22ab085 | 1 | #!/usr/bin/python |
3fdcb9d1 MT |
2 | ############################################################################### |
3 | # # | |
4 | # ddns - A dynamic DNS client for IPFire # | |
f1c73c2c | 5 | # Copyright (C) 2012-2017 IPFire development team # |
3fdcb9d1 MT |
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 | ############################################################################### | |
f22ab085 | 21 | |
4689f5d3 MT |
22 | N_ = lambda x: x |
23 | ||
f22ab085 | 24 | class DDNSError(Exception): |
4689f5d3 MT |
25 | """ |
26 | Generic error class for all exceptions | |
27 | raised by DDNS. | |
28 | """ | |
29 | reason = N_("Error") | |
f2d52251 | 30 | genre = "failure" |
4689f5d3 MT |
31 | |
32 | def __init__(self, message=None): | |
33 | self.message = message | |
f22ab085 MT |
34 | |
35 | ||
7a909224 | 36 | class DDNSNetworkError(DDNSError): |
4689f5d3 MT |
37 | """ |
38 | Thrown when a network error occured. | |
39 | """ | |
40 | reason = N_("Network error") | |
7a909224 MT |
41 | |
42 | ||
f22ab085 MT |
43 | class DDNSAbuseError(DDNSError): |
44 | """ | |
45 | Thrown when the server reports | |
46 | abuse for this account. | |
47 | """ | |
4689f5d3 | 48 | reason = N_("The server denied processing the request because account abuse is suspected") |
f22ab085 MT |
49 | |
50 | ||
51 | class DDNSAuthenticationError(DDNSError): | |
52 | """ | |
53 | Thrown when the server did not | |
54 | accept the user credentials. | |
55 | """ | |
4689f5d3 | 56 | reason = N_("Authentication against the server has failed") |
f22ab085 MT |
57 | |
58 | ||
dcd7fc54 SS |
59 | class DDNSBlockedError(DDNSError): |
60 | """ | |
61 | Thrown when the dynamic update client | |
62 | (specified by the user-agent) has been blocked | |
63 | by a dynamic DNS provider. | |
64 | """ | |
4689f5d3 | 65 | reason = N_("The server denies any updates from this client") |
dcd7fc54 SS |
66 | |
67 | ||
a6094ef6 MT |
68 | class DDNSCertificateError(DDNSError): |
69 | """ | |
70 | Thrown when a server presented an invalid certificate. | |
71 | """ | |
72 | reason = N_("Invalid certificate") | |
73 | ||
74 | ||
2e2be9df SS |
75 | class DDNSConfigurationError(DDNSError): |
76 | """ | |
77 | Thrown when invalid or insufficient | |
78 | data is provided by the configuration file. | |
79 | """ | |
4689f5d3 | 80 | reason = N_("The configuration file has errors") |
2e2be9df SS |
81 | |
82 | ||
7a909224 MT |
83 | class DDNSConnectionRefusedError(DDNSNetworkError): |
84 | """ | |
85 | Thrown when a connection is refused. | |
86 | """ | |
4689f5d3 | 87 | reason = N_("Connection refused") |
7a909224 MT |
88 | |
89 | ||
90 | class DDNSConnectionTimeoutError(DDNSNetworkError): | |
91 | """ | |
92 | Thrown when a connection to a server has timed out. | |
93 | """ | |
4689f5d3 | 94 | reason = N_("Connection timeout") |
7a909224 MT |
95 | |
96 | ||
1b8c6925 MT |
97 | class DDNSHostNotFoundError(DDNSError): |
98 | """ | |
99 | Thrown when a configuration entry could | |
100 | not be found. | |
101 | """ | |
4689f5d3 | 102 | reason = N_("The host could not be found in the configuration file") |
1b8c6925 MT |
103 | |
104 | ||
f22ab085 MT |
105 | class DDNSInternalServerError(DDNSError): |
106 | """ | |
107 | Thrown when the remote server reported | |
108 | an error on the provider site. | |
109 | """ | |
4689f5d3 | 110 | reason = N_("Internal server error") |
f22ab085 MT |
111 | |
112 | ||
7a909224 MT |
113 | class DDNSNetworkUnreachableError(DDNSNetworkError): |
114 | """ | |
115 | Thrown when a network is not reachable. | |
116 | """ | |
4689f5d3 | 117 | reason = N_("Network unreachable") |
7a909224 MT |
118 | |
119 | ||
5d98b003 MT |
120 | class DDNSNoRouteToHostError(DDNSNetworkError): |
121 | """ | |
122 | Thrown when there is no route to a host. | |
123 | """ | |
124 | reason = N_("No route to host") | |
125 | ||
126 | ||
ff43fa70 MT |
127 | class DDNSNotFound(DDNSError): |
128 | """ | |
129 | Thrown when the called URL has not been found | |
130 | """ | |
131 | reason = N_("Not found") | |
132 | ||
133 | ||
f22ab085 MT |
134 | class DDNSRequestError(DDNSError): |
135 | """ | |
136 | Thrown when a request could | |
137 | not be properly performed. | |
138 | """ | |
4689f5d3 | 139 | reason = N_("Request error") |
f22ab085 MT |
140 | |
141 | ||
694d8485 MT |
142 | class DDNSResolveError(DDNSNetworkError): |
143 | """ | |
144 | Thrown when a DNS record could not be resolved | |
145 | because of a local error. | |
146 | """ | |
147 | reason = N_("Could not resolve DNS entry") | |
148 | ||
149 | ||
a6094ef6 MT |
150 | class DDNSSSLError(DDNSNetworkError): |
151 | """ | |
152 | Raised when a SSL connection could not be | |
153 | negotiated. | |
154 | """ | |
155 | reason = N_("SSL negotiation error") | |
156 | ||
157 | ||
7a909224 MT |
158 | class DDNSServiceUnavailableError(DDNSNetworkError): |
159 | """ | |
160 | Equivalent to HTTP error code 503. | |
161 | """ | |
4689f5d3 | 162 | reason = N_("Service unavailable") |
7a909224 MT |
163 | |
164 | ||
f1c73c2c DW |
165 | class DDNSTooManyRequests(DDNSError): |
166 | """ | |
167 | Raised when too many requests occured. | |
168 | """ | |
169 | reason = N_("Too many requests") | |
f2d52251 | 170 | genre = "rate-limited" |
f1c73c2c DW |
171 | |
172 | ||
f22ab085 MT |
173 | class DDNSUpdateError(DDNSError): |
174 | """ | |
175 | Thrown when an update could not be | |
176 | properly performed. | |
177 | """ | |
4689f5d3 | 178 | reason = N_("The update could not be performed") |