]> git.ipfire.org Git - people/ms/ddns.git/commitdiff
Catch "no route to host" errors
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 23 Jun 2015 22:34:32 +0000 (22:34 +0000)
committerStefan Schantl <stefan.schantl@ipfire.org>
Wed, 1 Jul 2015 19:42:08 +0000 (21:42 +0200)
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 <michael.tremer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
src/ddns/errors.py
src/ddns/system.py

index 293b4eb8f58510c8e1c8d6218220e80584c8eb10..26bc18ec46d508c02bbd6836d3cce18495e79bd5 100644 (file)
@@ -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
index 8415579455763369a0a9ac844841ab2ee1f39945..6a21af85395af68ac149b545d7f8009e5a3cd713 100644 (file)
@@ -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