Skip to content

Commit

Permalink
Fixes #1382 gracefully recovers from local storage write error
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthieuLP committed Apr 14, 2021
1 parent 40316b8 commit 1fce0f7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions admin/themes/default/js/LocalStorageCache.js
Expand Up @@ -57,12 +57,18 @@
* @param data {mixed}
*/
LocalStorageCache.prototype.set = function(data) {
if (this.ready) {
this.storage[this.key] = JSON.stringify({
timestamp: new Date().getTime(),
key: this.serverKey,
data: data
});
try {
if (this.ready) {
this.storage[this.key] = JSON.stringify({
timestamp: new Date().getTime(),
key: this.serverKey,
data: data
});
}
} catch (e) {
console.log("Local storage error:");
console.log(e);
console.log("Use of direct result from Piwigo API.");
}
};

Expand Down

0 comments on commit 1fce0f7

Please sign in to comment.