reason = N_("Network unreachable")
+class DDNSNotFound(DDNSError):
+ """
+ Thrown when the called URL has not been found
+ """
+ reason = N_("Not found")
+
+
class DDNSRequestError(DDNSError):
"""
Thrown when a request could
response = self.send_request(url, data=data)
# Handle error codes.
- except urllib2.HTTPError, e:
- if e.code == 404:
- raise DDNSRequestError(_("Invalid hostname specified."))
-
- raise
+ except DDNSNotFound:
+ raise DDNSRequestError(_("Invalid hostname specified"))
# Handle success messages.
if response.code == 200:
elif e.code in (401, 403):
raise DDNSAuthenticationError(e.reason)
+ # 404 - Not found
+ # Either the provider has changed the API, or
+ # there is an error on the server
+ elif e.code == 404:
+ raise DDNSNotFound(e.reason)
+
# 500 - Internal Server Error
elif e.code == 500:
raise DDNSInternalServerError(e.reason)