sentry - rewrite report urls + use raven-js from npm

feature/default_network_editable
kumavis 7 years ago
parent 985e376911
commit e3d7062e9b
  1. 34
      app/scripts/lib/setupRaven.js
  2. 3
      app/scripts/vendor/raven.min.js
  3. 5
      package-lock.json
  4. 1
      package.json

@ -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 = `${filePath}`
return metamaskUrl
}

File diff suppressed because one or more lines are too long

5
package-lock.json generated

@ -17237,6 +17237,11 @@
"eve-raphael": "0.5.0"
}
},
"raven-js": {
"version": "3.24.0",
"resolved": "https://registry.npmjs.org/raven-js/-/raven-js-3.24.0.tgz",
"integrity": "sha512-+/ygcWib8PXAE7Xq53j1tYxCgkzFyp9z05LYAKp2PA9KwO4Ek74q1tkGwZyPWI/FoXOgas6jNtQ7O3tdPif6uA=="
},
"raw-body": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz",

@ -144,6 +144,7 @@
"pumpify": "^1.3.4",
"qrcode-npm": "0.0.3",
"ramda": "^0.24.1",
"raven-js": "^3.24.0",
"react": "^15.6.2",
"react-addons-css-transition-group": "^15.6.0",
"react-dom": "^15.6.2",

Loading…
Cancel
Save