mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
sentry - wrap report modifiers in a try-catch
This commit is contained in:
parent
5f3f8c85fc
commit
2a8d3ea450
@ -23,7 +23,24 @@ function setupRaven(opts) {
|
|||||||
release,
|
release,
|
||||||
transport: function(opts) {
|
transport: function(opts) {
|
||||||
const report = opts.data
|
const report = opts.data
|
||||||
// simplify certain complex error messages
|
try {
|
||||||
|
// simplify certain complex error messages (e.g. Ethjs)
|
||||||
|
simplifyErrorMessages(report)
|
||||||
|
// modify report urls
|
||||||
|
rewriteReportUrls(report)
|
||||||
|
} catch (err) {
|
||||||
|
console.warn(err)
|
||||||
|
}
|
||||||
|
// make request normally
|
||||||
|
client._makeRequest(opts)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
client.install()
|
||||||
|
|
||||||
|
return Raven
|
||||||
|
}
|
||||||
|
|
||||||
|
function simplifyErrorMessages(report) {
|
||||||
if (report.exception && report.exception.values) {
|
if (report.exception && report.exception.values) {
|
||||||
report.exception.values.forEach(item => {
|
report.exception.values.forEach(item => {
|
||||||
let errorMessage = item.value
|
let errorMessage = item.value
|
||||||
@ -38,15 +55,6 @@ function setupRaven(opts) {
|
|||||||
item.value = errorMessage
|
item.value = errorMessage
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
// modify report urls
|
|
||||||
rewriteReportUrls(report)
|
|
||||||
// make request normally
|
|
||||||
client._makeRequest(opts)
|
|
||||||
},
|
|
||||||
})
|
|
||||||
client.install()
|
|
||||||
|
|
||||||
return Raven
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function rewriteReportUrls(report) {
|
function rewriteReportUrls(report) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user