From: Michael Tremer Date: Tue, 23 Jun 2015 22:34:32 +0000 (+0000) Subject: Catch "no route to host" errors X-Git-Tag: 008~5 X-Git-Url: http://git.ipfire.org/?p=oddments%2Fddns.git;a=commitdiff_plain;h=5d98b00335d8c016c19c884e51c0a48aee2e1692 Catch "no route to host" errors When there is no route to a target host, we will throw a DDNSNetworkError so that this error can be handled afterwards. Signed-off-by: Michael Tremer Signed-off-by: Stefan Schantl --- diff --git a/src/ddns/errors.py b/src/ddns/errors.py index 293b4eb..26bc18e 100644 --- a/src/ddns/errors.py +++ b/src/ddns/errors.py @@ -109,6 +109,13 @@ class DDNSNetworkUnreachableError(DDNSNetworkError): reason = N_("Network unreachable") +class DDNSNoRouteToHostError(DDNSNetworkError): + """ + Thrown when there is no route to a host. + """ + reason = N_("No route to host") + + class DDNSNotFound(DDNSError): """ Thrown when the called URL has not been found diff --git a/src/ddns/system.py b/src/ddns/system.py index 8415579..6a21af8 100644 --- a/src/ddns/system.py +++ b/src/ddns/system.py @@ -211,6 +211,10 @@ class DDNSSystem(object): elif e.reason.errno == 111: raise DDNSConnectionRefusedError + # No route to host + elif e.reason.errno == 113: + raise DDNSNoRouteToHostError(req.host) + # Raise all other unhandled exceptions. raise