Fix exception when trying to read ajax responsetext in error handler

This commit is contained in:
Kovid Goyal 2019-01-17 09:21:50 +05:30
parent ecb302fa04
commit 473bff43e3
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -77,7 +77,10 @@ def set_error(event, is_network_error):
elif event is 'abort':
xhr.error_html = str.format(_('Failed to communicate with "{}", aborted'), xhr.request_path)
else:
rtext = xhr.responseText or ''
try:
rtext = xhr.responseText or ''
except:
rtext = ''
xhr.error_html = str.format(_('Failed to communicate with "{}", with status: [{}] {}<br><br>{}'), xhr.request_path, xhr.status, xhr.statusText, rtext[:200])
def progress_callback(ev):