aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-05-01 03:07:48 +0800
committerkumavis <aaron@kumavis.me>2018-05-01 03:07:48 +0800
commit2a8d3ea450791c9c932bff4908aab3e62a1408f5 (patch)
tree440dc6352aa9ed52c83e2c03791bbe94fe8a4bdb /app
parent5f3f8c85fcc5bd378ef1a886434a3e98546fee7f (diff)
downloadtangerine-wallet-browser-2a8d3ea450791c9c932bff4908aab3e62a1408f5.tar
tangerine-wallet-browser-2a8d3ea450791c9c932bff4908aab3e62a1408f5.tar.gz
tangerine-wallet-browser-2a8d3ea450791c9c932bff4908aab3e62a1408f5.tar.bz2
tangerine-wallet-browser-2a8d3ea450791c9c932bff4908aab3e62a1408f5.tar.lz
tangerine-wallet-browser-2a8d3ea450791c9c932bff4908aab3e62a1408f5.tar.xz
tangerine-wallet-browser-2a8d3ea450791c9c932bff4908aab3e62a1408f5.tar.zst
tangerine-wallet-browser-2a8d3ea450791c9c932bff4908aab3e62a1408f5.zip
sentry - wrap report modifiers in a try-catch
Diffstat (limited to 'app')
-rw-r--r--app/scripts/lib/setupRaven.js40
1 files changed, 24 insertions, 16 deletions
diff --git a/app/scripts/lib/setupRaven.js b/app/scripts/lib/setupRaven.js
index 48b941c3d..b69e08bae 100644
--- a/app/scripts/lib/setupRaven.js
+++ b/app/scripts/lib/setupRaven.js
@@ -23,23 +23,14 @@ function setupRaven(opts) {
release,
transport: function(opts) {
const report = opts.data
- // simplify certain complex error messages
- if (report.exception && report.exception.values) {
- report.exception.values.forEach(item => {
- let errorMessage = item.value
- // simplify ethjs error messages
- errorMessage = extractEthjsErrorMessage(errorMessage)
- // simplify 'Transaction Failed: known transaction'
- if (errorMessage.indexOf('Transaction Failed: known transaction') === 0) {
- // cut the hash from the error message
- errorMessage = 'Transaction Failed: known transaction'
- }
- // finalize
- item.value = errorMessage
- })
+ try {
+ // simplify certain complex error messages (e.g. Ethjs)
+ simplifyErrorMessages(report)
+ // modify report urls
+ rewriteReportUrls(report)
+ } catch (err) {
+ console.warn(err)
}
- // modify report urls
- rewriteReportUrls(report)
// make request normally
client._makeRequest(opts)
},
@@ -49,6 +40,23 @@ function setupRaven(opts) {
return Raven
}
+function simplifyErrorMessages(report) {
+ if (report.exception && report.exception.values) {
+ report.exception.values.forEach(item => {
+ let errorMessage = item.value
+ // simplify ethjs error messages
+ errorMessage = extractEthjsErrorMessage(errorMessage)
+ // simplify 'Transaction Failed: known transaction'
+ if (errorMessage.indexOf('Transaction Failed: known transaction') === 0) {
+ // cut the hash from the error message
+ errorMessage = 'Transaction Failed: known transaction'
+ }
+ // finalize
+ item.value = errorMessage
+ })
+ }
+}
+
function rewriteReportUrls(report) {
// update request url
report.request.url = toMetamaskUrl(report.request.url)