diff options
author | kumavis <kumavis@users.noreply.github.com> | 2018-04-30 05:15:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-30 05:15:57 +0800 |
commit | aa3dc83bf046d4c84d83976238c032dfeb953014 (patch) | |
tree | e20e8628e1c64a24bf64597670ee99b7bf23d99a | |
parent | 4e7b0ff15c5a57cd58497aa292c884a97e8a5d23 (diff) | |
parent | 873f85d9962ff569baa8a5bbf2c1337c3b920419 (diff) | |
download | tangerine-wallet-browser-aa3dc83bf046d4c84d83976238c032dfeb953014.tar tangerine-wallet-browser-aa3dc83bf046d4c84d83976238c032dfeb953014.tar.gz tangerine-wallet-browser-aa3dc83bf046d4c84d83976238c032dfeb953014.tar.bz2 tangerine-wallet-browser-aa3dc83bf046d4c84d83976238c032dfeb953014.tar.lz tangerine-wallet-browser-aa3dc83bf046d4c84d83976238c032dfeb953014.tar.xz tangerine-wallet-browser-aa3dc83bf046d4c84d83976238c032dfeb953014.tar.zst tangerine-wallet-browser-aa3dc83bf046d4c84d83976238c032dfeb953014.zip |
Merge pull request #4128 from MetaMask/raven-transport-fix
guard adainst raven erroring
-rw-r--r-- | app/scripts/background.js | 6 | ||||
-rw-r--r-- | app/scripts/lib/setupRaven.js | 37 |
2 files changed, 25 insertions, 18 deletions
diff --git a/app/scripts/background.js b/app/scripts/background.js index 38b871bb5..69d549c85 100644 --- a/app/scripts/background.js +++ b/app/scripts/background.js @@ -261,7 +261,11 @@ function setupController (initState, initLangCode) { controller.txController.on(`tx:status-update`, (txId, status) => { if (status !== 'failed') return const txMeta = controller.txController.txStateManager.getTx(txId) - reportFailedTxToSentry({ raven, txMeta }) + try { + reportFailedTxToSentry({ raven, txMeta }) + } catch (e) { + console.error(e) + } }) // setup state persistence diff --git a/app/scripts/lib/setupRaven.js b/app/scripts/lib/setupRaven.js index 9ec9a256f..48b941c3d 100644 --- a/app/scripts/lib/setupRaven.js +++ b/app/scripts/lib/setupRaven.js @@ -24,19 +24,20 @@ function setupRaven(opts) { transport: function(opts) { const report = opts.data // simplify certain complex error messages - report.exception.values.forEach(item => { - let errorMessage = item.value - // simplify ethjs error messages - errorMessage = extractEthjsErrorMessage(errorMessage) - // simplify 'Transaction Failed: known transaction' - if (errorMessage.indexOf('Transaction Failed: known transaction') === 0) { - // cut the hash from the error message - errorMessage = 'Transaction Failed: known transaction' - } - // finalize - item.value = errorMessage - }) - + if (report.exception && report.exception.values) { + report.exception.values.forEach(item => { + let errorMessage = item.value + // simplify ethjs error messages + errorMessage = extractEthjsErrorMessage(errorMessage) + // simplify 'Transaction Failed: known transaction' + if (errorMessage.indexOf('Transaction Failed: known transaction') === 0) { + // cut the hash from the error message + errorMessage = 'Transaction Failed: known transaction' + } + // finalize + item.value = errorMessage + }) + } // modify report urls rewriteReportUrls(report) // make request normally @@ -52,11 +53,13 @@ function rewriteReportUrls(report) { // update request url report.request.url = toMetamaskUrl(report.request.url) // update exception stack trace - report.exception.values.forEach(item => { - item.stacktrace.frames.forEach(frame => { - frame.filename = toMetamaskUrl(frame.filename) + if (report.exception && report.exception.values) { + report.exception.values.forEach(item => { + item.stacktrace.frames.forEach(frame => { + frame.filename = toMetamaskUrl(frame.filename) + }) }) - }) + } } function toMetamaskUrl(origUrl) { |