aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/setupRaven.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/lib/setupRaven.js')
-rw-r--r--app/scripts/lib/setupRaven.js32
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
+}