aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Huang <tmashuang@users.noreply.github.com>2018-05-01 04:19:45 +0800
committerGitHub <noreply@github.com>2018-05-01 04:19:45 +0800
commit5736a1f46d71872dee21efa3a167e4cfe12d5c0c (patch)
tree8500a75aa1f2756358615818656b8b3323824bcc
parent5f3f8c85fcc5bd378ef1a886434a3e98546fee7f (diff)
parente881ea7aaf1faea8fdbf730c09a1aadbf2366d45 (diff)
downloadtangerine-wallet-browser-5736a1f46d71872dee21efa3a167e4cfe12d5c0c.tar
tangerine-wallet-browser-5736a1f46d71872dee21efa3a167e4cfe12d5c0c.tar.gz
tangerine-wallet-browser-5736a1f46d71872dee21efa3a167e4cfe12d5c0c.tar.bz2
tangerine-wallet-browser-5736a1f46d71872dee21efa3a167e4cfe12d5c0c.tar.lz
tangerine-wallet-browser-5736a1f46d71872dee21efa3a167e4cfe12d5c0c.tar.xz
tangerine-wallet-browser-5736a1f46d71872dee21efa3a167e4cfe12d5c0c.tar.zst
tangerine-wallet-browser-5736a1f46d71872dee21efa3a167e4cfe12d5c0c.zip
Merge pull request #4139 from MetaMask/sentry-enhancementsv4.6.1
Sentry enhancements
-rw-r--r--app/scripts/lib/setupRaven.js50
1 files changed, 34 insertions, 16 deletions
diff --git a/app/scripts/lib/setupRaven.js b/app/scripts/lib/setupRaven.js
index 48b941c3d..b1b67f771 100644
--- a/app/scripts/lib/setupRaven.js
+++ b/app/scripts/lib/setupRaven.js
@@ -23,23 +23,16 @@ function setupRaven(opts) {
release,
transport: function(opts) {
const report = opts.data
- // simplify certain complex error messages
- 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
- })
+ try {
+ // handle error-like non-error exceptions
+ nonErrorException(report)
+ // simplify certain complex error messages (e.g. Ethjs)
+ simplifyErrorMessages(report)
+ // modify report urls
+ rewriteReportUrls(report)
+ } catch (err) {
+ console.warn(err)
}
- // modify report urls
- rewriteReportUrls(report)
// make request normally
client._makeRequest(opts)
},
@@ -49,6 +42,31 @@ function setupRaven(opts) {
return Raven
}
+function nonErrorException(report) {
+ // handle errors that lost their error-ness in serialization
+ if (report.message.includes('Non-Error exception captured with keys: message')) {
+ if (!(report.extra && report.extra.__serialized__)) return
+ report.message = `Non-Error Exception: ${report.extra.__serialized__.message}`
+ }
+}
+
+function simplifyErrorMessages(report) {
+ 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
+ })
+ }
+}
+
function rewriteReportUrls(report) {
// update request url
report.request.url = toMetamaskUrl(report.request.url)