diff --git a/onadata/libs/utils/logger_tools.py b/onadata/libs/utils/logger_tools.py index 194bc8f167..ebc71e382d 100644 --- a/onadata/libs/utils/logger_tools.py +++ b/onadata/libs/utils/logger_tools.py @@ -24,6 +24,7 @@ from django.utils import timezone from django.utils.encoding import DjangoUnicodeDecodeError from django.utils.translation import ugettext as _ +from http.client import BadStatusLine from modilabs.utils.subprocess_timeout import ProcessTimedOut from multidb.pinning import use_master from pyxform.errors import PyXFormError @@ -501,6 +502,12 @@ def publish_form(callback): 'text': _((u'An error occurred while publishing the form. ' 'Please try again.')), } + except BadStatusLine: + # Catch urllib error + return { + 'type': 'alert-error', + 'text': _(u'An error occured while trying to retrieve the form.') + } except (AttributeError, Exception, ValidationError) as e: report_exception("Form publishing exception: {}".format(e), text(e), sys.exc_info())