Show request path when failing to load library data

This commit is contained in:
Kovid Goyal 2015-10-16 16:44:18 +05:30
parent 485c2d8af1
commit d7ceb3dd23
2 changed files with 4 additions and 3 deletions

View File

@ -5,6 +5,7 @@ def ajax(path, on_complete, on_progress=None, bypass_cache=True, method='GET'):
xhr = XMLHttpRequest() xhr = XMLHttpRequest()
if bypass_cache: if bypass_cache:
path += ('&' if '?' in path else '?') + Date().getTime() path += ('&' if '?' in path else '?') + Date().getTime()
xhr.request_path = path
def progress_callback(ev): def progress_callback(ev):
if ev.lengthComputable: if ev.lengthComputable:

View File

@ -12,9 +12,9 @@ def on_library_loaded(end_type, xhr, ev):
data = xhr.response data = xhr.response
data data
else: else:
document.body.appendChild(E.p(style="color:red", _( document.body.appendChild(E.p(style="color:red", str.format(_(
'Failed to download library data, with status:') + str.format(' [{}] {}', xhr.status, xhr.statusText) 'Failed to download library data from "{}", with status: [{}] {}'),
)) xhr.request_path, xhr.status, xhr.statusText)))
def on_library_load_progress(loaded, total): def on_library_load_progress(loaded, total):
p = document.querySelector('#page_load_progress > progress') p = document.querySelector('#page_load_progress > progress')