guard adainst raven erroring

feature/default_network_editable
frankiebee 7 years ago
parent 4e7b0ff15c
commit 873f85d996
  1. 4
      app/scripts/background.js
  2. 5
      app/scripts/lib/setupRaven.js

@ -261,7 +261,11 @@ function setupController (initState, initLangCode) {
controller.txController.on(`tx:status-update`, (txId, status) => { controller.txController.on(`tx:status-update`, (txId, status) => {
if (status !== 'failed') return if (status !== 'failed') return
const txMeta = controller.txController.txStateManager.getTx(txId) const txMeta = controller.txController.txStateManager.getTx(txId)
try {
reportFailedTxToSentry({ raven, txMeta }) reportFailedTxToSentry({ raven, txMeta })
} catch (e) {
console.error(e)
}
}) })
// setup state persistence // setup state persistence

@ -24,6 +24,7 @@ function setupRaven(opts) {
transport: function(opts) { transport: function(opts) {
const report = opts.data const report = opts.data
// simplify certain complex error messages // simplify certain complex error messages
if (report.exception && report.exception.values) {
report.exception.values.forEach(item => { report.exception.values.forEach(item => {
let errorMessage = item.value let errorMessage = item.value
// simplify ethjs error messages // simplify ethjs error messages
@ -36,7 +37,7 @@ function setupRaven(opts) {
// finalize // finalize
item.value = errorMessage item.value = errorMessage
}) })
}
// modify report urls // modify report urls
rewriteReportUrls(report) rewriteReportUrls(report)
// make request normally // make request normally
@ -52,11 +53,13 @@ function rewriteReportUrls(report) {
// update request url // update request url
report.request.url = toMetamaskUrl(report.request.url) report.request.url = toMetamaskUrl(report.request.url)
// update exception stack trace // update exception stack trace
if (report.exception && report.exception.values) {
report.exception.values.forEach(item => { report.exception.values.forEach(item => {
item.stacktrace.frames.forEach(frame => { item.stacktrace.frames.forEach(frame => {
frame.filename = toMetamaskUrl(frame.filename) frame.filename = toMetamaskUrl(frame.filename)
}) })
}) })
}
} }
function toMetamaskUrl(origUrl) { function toMetamaskUrl(origUrl) {

Loading…
Cancel
Save