Exception handling for storageManager setItem, sessionHistory save to disk notice
This commit is contained in:
@@ -22,7 +22,7 @@ class SessionHistoryMenu {
|
||||
})
|
||||
$scope.history = history;
|
||||
}
|
||||
|
||||
|
||||
$scope.reloadHistory();
|
||||
|
||||
$scope.openRevision = function(revision) {
|
||||
@@ -65,6 +65,11 @@ class SessionHistoryMenu {
|
||||
}
|
||||
|
||||
$scope.toggleDiskSaving = function() {
|
||||
if(!sessionHistory.diskEnabled) {
|
||||
if(!confirm("Are you sure you want to save history to disk? This will decrease general performance, especially as you type. You are advised to disable this feature if you experience any lagging.")){
|
||||
return;
|
||||
}
|
||||
}
|
||||
sessionHistory.toggleDiskSaving().then(() => {
|
||||
$timeout(() => {
|
||||
$scope.diskEnabled = sessionHistory.diskEnabled;
|
||||
|
||||
@@ -107,7 +107,12 @@ class StorageManager extends SFStorageManager {
|
||||
|
||||
async setItem(key, value, vaultKey) {
|
||||
var storage = this.getVault(vaultKey);
|
||||
storage.setItem(key, value);
|
||||
try {
|
||||
storage.setItem(key, value);
|
||||
} catch (e) {
|
||||
console.error("Exception while trying to setItem in StorageManager:", e);
|
||||
alert("The application's local storage is out of space. If you have Session History save-to-disk enabled, please disable it, and try again.");
|
||||
}
|
||||
|
||||
if(vaultKey === StorageManager.FixedEncrypted || (!vaultKey && this.itemsStorageMode === StorageManager.FixedEncrypted)) {
|
||||
this.writeEncryptedStorageToDisk();
|
||||
|
||||
Reference in New Issue
Block a user