Catch various network/server errors.
[oddments/ddns.git] / src / ddns / errors.py
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 class DDNSError(Exception):
23         pass
24
25
26 class DDNSNetworkError(DDNSError):
27         pass
28
29
30 class DDNSAbuseError(DDNSError):
31         """
32                 Thrown when the server reports
33                 abuse for this account.
34         """
35         pass
36
37
38 class DDNSAuthenticationError(DDNSError):
39         """
40                 Thrown when the server did not
41                 accept the user credentials.
42         """
43         pass
44
45
46 class DDNSBlockedError(DDNSError):
47         """
48                 Thrown when the dynamic update client
49                 (specified by the user-agent) has been blocked
50                 by a dynamic DNS provider.
51         """
52         pass
53
54
55 class DDNSConfigurationError(DDNSError):
56         """
57                 Thrown when invalid or insufficient
58                 data is provided by the configuration file.
59         """
60         pass
61
62
63 class DDNSConnectionRefusedError(DDNSNetworkError):
64         """
65                 Thrown when a connection is refused.
66         """
67         pass
68
69
70 class DDNSConnectionTimeoutError(DDNSNetworkError):
71         """
72                 Thrown when a connection to a server has timed out.
73         """
74         pass
75
76
77 class DDNSHostNotFoundError(DDNSError):
78         """
79                 Thrown when a configuration entry could
80                 not be found.
81         """
82         pass
83
84
85 class DDNSInternalServerError(DDNSError):
86         """
87                 Thrown when the remote server reported
88                 an error on the provider site.
89         """
90         pass
91
92
93 class DDNSNetworkUnreachableError(DDNSNetworkError):
94         """
95                 Thrown when a network is not reachable.
96         """
97         pass
98
99
100 class DDNSRequestError(DDNSError):
101         """
102                 Thrown when a request could
103                 not be properly performed.
104         """
105         pass
106
107
108 class DDNSServiceUnavailableError(DDNSNetworkError):
109         """
110                 Equivalent to HTTP error code 503.
111         """
112         pass
113
114
115 class DDNSUpdateError(DDNSError):
116         """
117                 Thrown when an update could not be
118                 properly performed.
119         """
120         pass