mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix exception when trying to read ajax responsetext in error handler
This commit is contained in:
parent
ecb302fa04
commit
473bff43e3
@ -77,7 +77,10 @@ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET', q
|
|||||||
elif event is 'abort':
|
elif event is 'abort':
|
||||||
xhr.error_html = str.format(_('Failed to communicate with "{}", aborted'), xhr.request_path)
|
xhr.error_html = str.format(_('Failed to communicate with "{}", aborted'), xhr.request_path)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
rtext = xhr.responseText or ''
|
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])
|
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):
|
def progress_callback(ev):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user