diff options
author | kumavis <aaron@kumavis.me> | 2018-10-20 15:14:59 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2018-10-20 15:14:59 +0800 |
commit | 73ec4e66cb7a476d01371a61692b0d8d9224da04 (patch) | |
tree | 96c2b2b20030e63eebbf0f08e669091968f1a223 /app | |
parent | e3fda83ab209af7836ba93bfaba215c271d73e8a (diff) | |
download | tangerine-wallet-browser-73ec4e66cb7a476d01371a61692b0d8d9224da04.tar.gz tangerine-wallet-browser-73ec4e66cb7a476d01371a61692b0d8d9224da04.tar.zst tangerine-wallet-browser-73ec4e66cb7a476d01371a61692b0d8d9224da04.zip |
sentry - include app state in ui errors
Diffstat (limited to 'app')
-rw-r--r-- | app/scripts/lib/setupSentry.js | 8 | ||||
-rw-r--r-- | app/scripts/ui.js | 12 |
2 files changed, 18 insertions, 2 deletions
diff --git a/app/scripts/lib/setupSentry.js b/app/scripts/lib/setupSentry.js index aa8d72194..69042bc19 100644 --- a/app/scripts/lib/setupSentry.js +++ b/app/scripts/lib/setupSentry.js @@ -8,7 +8,7 @@ module.exports = setupSentry // Setup sentry remote error reporting function setupSentry (opts) { - const { release } = opts + const { release, getState } = opts let sentryTarget // detect brave const isBrave = Boolean(window.chrome.ipcRenderer) @@ -38,9 +38,15 @@ function setupSentry (opts) { simplifyErrorMessages(report) // modify report urls rewriteReportUrls(report) + // append app state + if (getState) { + const appState = getState() + report.extra.appState = appState + } } catch (err) { console.warn(err) } + return report } return Sentry diff --git a/app/scripts/ui.js b/app/scripts/ui.js index 8893ceaad..c4f6615db 100644 --- a/app/scripts/ui.js +++ b/app/scripts/ui.js @@ -21,7 +21,17 @@ async function start () { // setup sentry error reporting const release = global.platform.getVersion() - setupSentry({ release }) + setupSentry({ release, getState }) + // provide app state to append to error logs + function getState() { + // get app state + const state = window.getCleanAppState() + // remove unnecessary data + delete state.localeMessages + delete state.metamask.recentBlocks + // return state to be added to request + return state + } // inject css // const css = MetaMaskUiCss() |