Skip to content

Commit

Permalink
Handle unconventional status codes
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisRayM committed Jan 10, 2020
1 parent 3badc7c commit e7a65dd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions onadata/libs/utils/logger_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit e7a65dd

Please sign in to comment.