diff options
author | Frankie <frankie.diamond@gmail.com> | 2018-03-28 10:13:42 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-28 10:13:42 +0800 |
commit | 76e83365ca48d2162e503b1bc6b0563a53b218e2 (patch) | |
tree | 4b29f4547c82ec6abb5d9348a417c0a462da876c /app/scripts/lib/reportFailedTxToSentry.js | |
parent | f7a2dc984ef352de6bdbdd50bb6671593dc96048 (diff) | |
parent | 651e48dbd6a8bbcf2561d62c93897309143e2a9e (diff) | |
download | tangerine-wallet-browser-76e83365ca48d2162e503b1bc6b0563a53b218e2.tar.gz tangerine-wallet-browser-76e83365ca48d2162e503b1bc6b0563a53b218e2.tar.zst tangerine-wallet-browser-76e83365ca48d2162e503b1bc6b0563a53b218e2.zip |
Merge pull request #3752 from MetaMask/sentry-error-fix
sentry - simplify all ethjs errors for better batching
Diffstat (limited to 'app/scripts/lib/reportFailedTxToSentry.js')
-rw-r--r-- | app/scripts/lib/reportFailedTxToSentry.js | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/app/scripts/lib/reportFailedTxToSentry.js b/app/scripts/lib/reportFailedTxToSentry.js index ee73f6845..e09f4f1f8 100644 --- a/app/scripts/lib/reportFailedTxToSentry.js +++ b/app/scripts/lib/reportFailedTxToSentry.js @@ -1,5 +1,4 @@ -const ethJsRpcSlug = 'Error: [ethjs-rpc] rpc error with payload ' -const errorLabelPrefix = 'Error: ' +const extractEthjsErrorMessage = require('./extractEthjsErrorMessage') module.exports = reportFailedTxToSentry @@ -9,30 +8,9 @@ module.exports = reportFailedTxToSentry // function reportFailedTxToSentry({ raven, txMeta }) { - const errorMessage = extractErrorMessage(txMeta.err.message) + const errorMessage = 'Transaction Failed: ' + extractEthjsErrorMessage(txMeta.err.message) raven.captureMessage(errorMessage, { // "extra" key is required by Sentry extra: txMeta, }) } - -// -// ethjs-rpc provides overly verbose error messages -// if we detect this type of message, we extract the important part -// Below is an example input and output -// -// Error: [ethjs-rpc] rpc error with payload {"id":3947817945380,"jsonrpc":"2.0","params":["0xf8eb8208708477359400830398539406012c8cf97bead5deae237070f9587f8e7a266d80b8843d7d3f5a0000000000000000000000000000000000000000000000000000000000081d1a000000000000000000000000000000000000000000000000001ff973cafa800000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000003f48025a04c32a9b630e0d9e7ff361562d850c86b7a884908135956a7e4a336fa0300d19ca06830776423f25218e8d19b267161db526e66895567147015b1f3fc47aef9a3c7"],"method":"eth_sendRawTransaction"} Error: replacement transaction underpriced -// -// Transaction Failed: replacement transaction underpriced -// - -function extractErrorMessage(errorMessage) { - const isEthjsRpcError = errorMessage.includes(ethJsRpcSlug) - if (isEthjsRpcError) { - const payloadAndError = errorMessage.slice(ethJsRpcSlug.length) - const originalError = payloadAndError.slice(payloadAndError.indexOf(errorLabelPrefix) + errorLabelPrefix.length) - return `Transaction Failed: ${originalError}` - } else { - return `Transaction Failed: ${errorMessage}` - } -} |