aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/background.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-04-06 04:15:08 +0800
committerkumavis <aaron@kumavis.me>2018-04-06 04:15:08 +0800
commit2b880dd4e060f8f7f95afe9ff2a3e2e6d540c922 (patch)
tree8d7875da5984f9df1a8258caba76c9ae03e40f02 /app/scripts/background.js
parentbcb5f14b06959a9fd147361fa341e587b45baa76 (diff)
downloadtangerine-wallet-browser-2b880dd4e060f8f7f95afe9ff2a3e2e6d540c922.tar
tangerine-wallet-browser-2b880dd4e060f8f7f95afe9ff2a3e2e6d540c922.tar.gz
tangerine-wallet-browser-2b880dd4e060f8f7f95afe9ff2a3e2e6d540c922.tar.bz2
tangerine-wallet-browser-2b880dd4e060f8f7f95afe9ff2a3e2e6d540c922.tar.lz
tangerine-wallet-browser-2b880dd4e060f8f7f95afe9ff2a3e2e6d540c922.tar.xz
tangerine-wallet-browser-2b880dd4e060f8f7f95afe9ff2a3e2e6d540c922.tar.zst
tangerine-wallet-browser-2b880dd4e060f8f7f95afe9ff2a3e2e6d540c922.zip
migrations - report migrations errors to sentry with vault structure
Diffstat (limited to 'app/scripts/background.js')
-rw-r--r--app/scripts/background.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js
index 3ad0a7863..ec586f642 100644
--- a/app/scripts/background.js
+++ b/app/scripts/background.js
@@ -20,6 +20,7 @@ const reportFailedTxToSentry = require('./lib/reportFailedTxToSentry')
const setupMetamaskMeshMetrics = require('./lib/setupMetamaskMeshMetrics')
const EdgeEncryptor = require('./edge-encryptor')
const getFirstPreferredLangCode = require('./lib/get-first-preferred-lang-code')
+const getObjStructure = require('./lib/getObjStructure')
const STORAGE_KEY = 'metamask-config'
const METAMASK_DEBUG = process.env.METAMASK_DEBUG
@@ -77,6 +78,16 @@ async function loadStateFromPersistence () {
diskStore.getState() ||
migrator.generateInitialState(firstTimeState)
+ // report migration errors to sentry
+ migrator.on('error', (err) => {
+ // get vault structure without secrets
+ const vaultStructure = getObjStructure(versionedData)
+ raven.captureException(err, {
+ // "extra" key is required by Sentry
+ extra: { vaultStructure },
+ })
+ })
+
// migrate data
versionedData = await migrator.migrateData(versionedData)
if (!versionedData) {
@@ -84,7 +95,14 @@ async function loadStateFromPersistence () {
}
// write to disk
- if (localStore.isSupported) localStore.set(versionedData)
+ if (localStore.isSupported) {
+ localStore.set(versionedData)
+ } else {
+ // throw in setTimeout so as to not block boot
+ setTimeout(() => {
+ throw new Error('MetaMask - Localstore not supported')
+ })
+ }
// return just the data
return versionedData.data