Skip to content

Commit

Permalink
Catch id local and session storage is not accessible (#101)
Browse files Browse the repository at this point in the history
* Catch id local and session storage is not accessible

* fix
  • Loading branch information
soulgalore authored Jun 22, 2023
1 parent 8876552 commit cb8cf63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/dom/info/localStorageSize.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
return 0;
}
}

return storageSize(window.localStorage);
try {
return storageSize(window.localStorage);
} catch (error) {
return 'Could not access localStorage.';
}
})();
6 changes: 5 additions & 1 deletion lib/dom/info/sessionStorageSize.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@
return bytes;
}

return storageSize(window.sessionStorage);
try {
return storageSize(window.sessionStorage);
} catch (error) {
return 'Could not access sessionStorage';
}
})();

0 comments on commit cb8cf63

Please sign in to comment.