Show the message about clearing the cache in the right place

This commit is contained in:
Kovid Goyal 2017-06-27 00:51:04 +05:30
parent f0545dacb9
commit aae905d843
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -294,13 +294,15 @@ class DB:
key = file_store_name(book, name) key = file_store_name(book, name)
err = _( err = _(
'Failed to read the file {0} for the book {1} from the browser offline cache.' 'Failed to read the file {0} for the book {1} from the browser offline cache.'
' This usually means the cache is close to full. Clear the browser' ).format(name, book.metadata.title)
' cache from the browser settings.').format(name, book.metadata.title)
self.do_op(['files'], key, err, def (result): self.do_op(['files'], key, err, def (result):
if not result: if not result:
# File was not found in the cache, this happens in Chrome if # File was not found in the cache, this happens in Chrome if
# the Application Cache is full. IndexedDB put succeeds, # the Application Cache is full. IndexedDB put succeeds,
# but get fails. Browsers are a horrible travesty. # but get fails. Browsers are a horrible travesty.
err += _(
' This usually means the cache is close to full. Clear the browser'
' cache from the browser settings.')
self.show_error(_('Cannot read file from book'), err) self.show_error(_('Cannot read file from book'), err)
return return
fdata = book.stored_files[key] fdata = book.stored_files[key]
@ -313,9 +315,7 @@ class DB:
def get_mathjax_files(self, proceed): def get_mathjax_files(self, proceed):
c = self.idb.transaction('mathjax').objectStore('mathjax').openCursor() c = self.idb.transaction('mathjax').objectStore('mathjax').openCursor()
c.onerror = def(event): c.onerror = def(event):
err = _('Failed to read the MathJax files from local storage.' err = _('Failed to read the MathJax files from the browser offline cache.')
' This usually means the cache is close to full. Clear the browser'
' cache from the browser settings.')
self.display_error(err, event) self.display_error(err, event)
data = {} data = {}
c.onsuccess = def(event): c.onsuccess = def(event):