|
|
|
@ -23,7 +23,34 @@ function setupRaven(opts) { |
|
|
|
|
release, |
|
|
|
|
transport: function(opts) { |
|
|
|
|
const report = opts.data |
|
|
|
|
// simplify certain complex error messages
|
|
|
|
|
try { |
|
|
|
|
// handle error-like non-error exceptions
|
|
|
|
|
nonErrorException(report) |
|
|
|
|
// 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 nonErrorException(report) { |
|
|
|
|
// handle errors that lost their error-ness in serialization
|
|
|
|
|
if (report.message.includes('Non-Error exception captured with keys: message')) { |
|
|
|
|
if (!(report.extra && report.extra.__serialized__)) return |
|
|
|
|
report.message = `Non-Error Exception: ${report.extra.__serialized__.message}` |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function simplifyErrorMessages(report) { |
|
|
|
|
if (report.exception && report.exception.values) { |
|
|
|
|
report.exception.values.forEach(item => { |
|
|
|
|
let errorMessage = item.value |
|
|
|
@ -38,15 +65,6 @@ function setupRaven(opts) { |
|
|
|
|
item.value = errorMessage |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
// modify report urls
|
|
|
|
|
rewriteReportUrls(report) |
|
|
|
|
// make request normally
|
|
|
|
|
client._makeRequest(opts) |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
client.install() |
|
|
|
|
|
|
|
|
|
return Raven |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function rewriteReportUrls(report) { |
|
|
|
|