]>
Commit | Line | Data |
---|---|---|
f22ab085 | 1 | #!/usr/bin/python |
3fdcb9d1 MT |
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 | ############################################################################### | |
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") | |
30 | ||
31 | def __init__(self, message=None): | |
32 | self.message = message | |
f22ab085 MT |
33 | |
34 | ||
7a909224 | 35 | class DDNSNetworkError(DDNSError): |
4689f5d3 MT |
36 | """ |
37 | Thrown when a network error occured. | |
38 | """ | |
39 | reason = N_("Network error") | |
7a909224 MT |
40 | |
41 | ||
f22ab085 MT |
42 | class DDNSAbuseError(DDNSError): |
43 | """ | |
44 | Thrown when the server reports | |
45 | abuse for this account. | |
46 | """ | |
4689f5d3 | 47 | reason = N_("The server denied processing the request because account abuse is suspected") |
f22ab085 MT |
48 | |
49 | ||
50 | class DDNSAuthenticationError(DDNSError): | |
51 | """ | |
52 | Thrown when the server did not | |
53 | accept the user credentials. | |
54 | """ | |
4689f5d3 | 55 | reason = N_("Authentication against the server has failed") |
f22ab085 MT |
56 | |
57 | ||
dcd7fc54 SS |
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 | """ | |
4689f5d3 | 64 | reason = N_("The server denies any updates from this client") |
dcd7fc54 SS |
65 | |
66 | ||
2e2be9df SS |
67 | class DDNSConfigurationError(DDNSError): |
68 | """ | |
69 | Thrown when invalid or insufficient | |
70 | data is provided by the configuration file. | |
71 | """ | |
4689f5d3 | 72 | reason = N_("The configuration file has errors") |
2e2be9df SS |
73 | |
74 | ||
7a909224 MT |
75 | class DDNSConnectionRefusedError(DDNSNetworkError): |
76 | """ | |
77 | Thrown when a connection is refused. | |
78 | """ | |
4689f5d3 | 79 | reason = N_("Connection refused") |
7a909224 MT |
80 | |
81 | ||
82 | class DDNSConnectionTimeoutError(DDNSNetworkError): | |
83 | """ | |
84 | Thrown when a connection to a server has timed out. | |
85 | """ | |
4689f5d3 | 86 | reason = N_("Connection timeout") |
7a909224 MT |
87 | |
88 | ||
1b8c6925 MT |
89 | class DDNSHostNotFoundError(DDNSError): |
90 | """ | |
91 | Thrown when a configuration entry could | |
92 | not be found. | |
93 | """ | |
4689f5d3 | 94 | reason = N_("The host could not be found in the configuration file") |
1b8c6925 MT |
95 | |
96 | ||
f22ab085 MT |
97 | class DDNSInternalServerError(DDNSError): |
98 | """ | |
99 | Thrown when the remote server reported | |
100 | an error on the provider site. | |
101 | """ | |
4689f5d3 | 102 | reason = N_("Internal server error") |
f22ab085 MT |
103 | |
104 | ||
7a909224 MT |
105 | class DDNSNetworkUnreachableError(DDNSNetworkError): |
106 | """ | |
107 | Thrown when a network is not reachable. | |
108 | """ | |
4689f5d3 | 109 | reason = N_("Network unreachable") |
7a909224 MT |
110 | |
111 | ||
f22ab085 MT |
112 | class DDNSRequestError(DDNSError): |
113 | """ | |
114 | Thrown when a request could | |
115 | not be properly performed. | |
116 | """ | |
4689f5d3 | 117 | reason = N_("Request error") |
f22ab085 MT |
118 | |
119 | ||
7a909224 MT |
120 | class DDNSServiceUnavailableError(DDNSNetworkError): |
121 | """ | |
122 | Equivalent to HTTP error code 503. | |
123 | """ | |
4689f5d3 | 124 | reason = N_("Service unavailable") |
7a909224 MT |
125 | |
126 | ||
f22ab085 MT |
127 | class DDNSUpdateError(DDNSError): |
128 | """ | |
129 | Thrown when an update could not be | |
130 | properly performed. | |
131 | """ | |
4689f5d3 | 132 | reason = N_("The update could not be performed") |