From 3d922e4f1302ad1978513b1d5a18b1ca07654a70 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Wed, 28 May 2014 15:19:21 +0200 Subject: [PATCH] catch "Network is unreachable" error --- nsupdate/main/views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nsupdate/main/views.py b/nsupdate/main/views.py index 30b71b3..ef4467d 100644 --- a/nsupdate/main/views.py +++ b/nsupdate/main/views.py @@ -3,6 +3,7 @@ views for the interactive web user interface """ +import socket from datetime import timedelta from django.db.models import Q @@ -203,6 +204,8 @@ class OverviewView(CreateView): except Domain.DoesNotExist: # should not happen: POST data had invalid (base)domain success, level, msg = False, messages.ERROR, 'Base domain does not exist.' + except socket.error as err: + success, level, msg = False, messages.ERROR, 'Communication to name server failed [%s]' % str(err) else: self.object.created_by = self.request.user self.object.save()