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();
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
Automatically cleans up small revisions to conserve space.
|
||||
%menu-row{"label" => "(diskEnabled ? 'Disable' : 'Enable') + ' saving history to disk'", "action" => "toggleDiskSaving()"}
|
||||
.sk-sublabel
|
||||
Saving to disk may increase app loading time and memory footprint.
|
||||
Saving to disk is not recommended. Decreases performance and increases app loading time and memory footprint.
|
||||
|
||||
%menu-row{"ng-repeat" => "revision in entries",
|
||||
"action" => "openRevision(revision);",
|
||||
|
||||
Reference in New Issue
Block a user