From 473bff43e3f41c410caecb23945819c6d3e71ad2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 17 Jan 2019 09:21:50 +0530 Subject: [PATCH] Fix exception when trying to read ajax responsetext in error handler --- src/pyj/ajax.pyj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pyj/ajax.pyj b/src/pyj/ajax.pyj index 341ce5c95b..7a8c453e5e 100644 --- a/src/pyj/ajax.pyj +++ b/src/pyj/ajax.pyj @@ -77,7 +77,10 @@ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', q 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: [{}] {}

{}'), xhr.request_path, xhr.status, xhr.statusText, rtext[:200]) def progress_callback(ev):