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