diff options
author | Dan <danjm.com@gmail.com> | 2018-03-27 02:43:49 +0800 |
---|---|---|
committer | Dan <danjm.com@gmail.com> | 2018-03-27 02:43:49 +0800 |
commit | 4f0881e41be82de28ae6a444f54123b0ee2a04a0 (patch) | |
tree | dc8e623792f60ddc8309766515cab7d8f89ae89a /app/scripts/lib | |
parent | 35baff15aa181a5ec647d5738c027c8ba1ee9285 (diff) | |
parent | 4efb1c6b491901cbb42ef27a4c6c55814f24d764 (diff) | |
download | tangerine-wallet-browser-4f0881e41be82de28ae6a444f54123b0ee2a04a0.tar.gz tangerine-wallet-browser-4f0881e41be82de28ae6a444f54123b0ee2a04a0.tar.zst tangerine-wallet-browser-4f0881e41be82de28ae6a444f54123b0ee2a04a0.zip |
Merge branch 'master' into i18n-translator-redux
Diffstat (limited to 'app/scripts/lib')
-rw-r--r-- | app/scripts/lib/setupRaven.js | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/app/scripts/lib/setupRaven.js b/app/scripts/lib/setupRaven.js index 42e48cb90..02c01b755 100644 --- a/app/scripts/lib/setupRaven.js +++ b/app/scripts/lib/setupRaven.js @@ -1,4 +1,4 @@ -const Raven = require('../vendor/raven.min.js') +const Raven = require('raven-js') const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG' const PROD = 'https://3567c198f8a8412082d32655da2961d0@sentry.io/273505' const DEV = 'https://f59f3dd640d2429d9d0e2445a87ea8e1@sentry.io/273496' @@ -18,9 +18,35 @@ function setupRaven(opts) { ravenTarget = PROD } - Raven.config(ravenTarget, { + const client = Raven.config(ravenTarget, { release, - }).install() + transport: function(opts) { + // modify report urls + const report = opts.data + rewriteReportUrls(report) + // make request normally + client._makeRequest(opts) + }, + }) + client.install() return Raven } + +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) + }) + }) +} + +function toMetamaskUrl(origUrl) { + const filePath = origUrl.split(location.origin)[1] + if (!filePath) return origUrl + const metamaskUrl = `metamask${filePath}` + return metamaskUrl +} |