aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-01-24 21:11:32 +0800
committerDan <danjm.com@gmail.com>2018-01-24 21:11:32 +0800
commit0164030e56b1db8117a1a0bdff91987321b2cd1a (patch)
tree719acea836cd490ff7475b8b8defeab8709e5ad5 /app/scripts
parent7c4a9c32fa449197bf790b6ce6e91c41efe05ab9 (diff)
downloadtangerine-wallet-browser-0164030e56b1db8117a1a0bdff91987321b2cd1a.tar
tangerine-wallet-browser-0164030e56b1db8117a1a0bdff91987321b2cd1a.tar.gz
tangerine-wallet-browser-0164030e56b1db8117a1a0bdff91987321b2cd1a.tar.bz2
tangerine-wallet-browser-0164030e56b1db8117a1a0bdff91987321b2cd1a.tar.lz
tangerine-wallet-browser-0164030e56b1db8117a1a0bdff91987321b2cd1a.tar.xz
tangerine-wallet-browser-0164030e56b1db8117a1a0bdff91987321b2cd1a.tar.zst
tangerine-wallet-browser-0164030e56b1db8117a1a0bdff91987321b2cd1a.zip
Handle errors when getting and setting to localStore.
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/background.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 280c28d70..88600bf1e 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -57,7 +57,13 @@ async function loadStateFromPersistence () {
// fetch from extension store and merge in data
if (localStore.isSupported) {
- const localData = await localStore.get()
+ let localData
+ try {
+ localData = await localStore.get()
+ } catch (err) {
+ log.error('error fetching state from local store:', err)
+ }
+
// TODO: handle possible exceptions (https://developer.chrome.com/apps/runtime#property-lastError)
versionedData = Object.keys(localData).length > 0 ? localData : versionedData
}
@@ -113,7 +119,11 @@ function setupController (initState) {
function syncDataWithExtension(state) {
if (localStore.isSupported) {
- localStore.set(state) // TODO: handle possible exceptions (https://developer.chrome.com/apps/runtime#property-lastError)
+ try {
+ localStore.set(state)
+ } catch (err) {
+ log.error('error setting state in local store:', err)
+ }
}
return state
}