Commit 4fc4bdcd authored by Vignesh Mohankumar's avatar Vignesh Mohankumar Committed by GitHub

fix: propagates user rejection errors (#6533)

parent 3733570a
......@@ -74,6 +74,11 @@ describe('filterKnownErrors', () => {
expect(filterKnownErrors(ERROR, { originalException })).toBe(ERROR)
})
it('propagates user rejected request errors', () => {
const originalException = new Error('user rejected transaction')
expect(filterKnownErrors(ERROR, { originalException })).toBe(ERROR)
})
it('filters block number polling errors', () => {
const originalException = new (class extends Error {
requestBody = JSON.stringify({ method: 'eth_blockNumber' })
......@@ -86,11 +91,6 @@ describe('filterKnownErrors', () => {
expect(filterKnownErrors(ERROR, { originalException })).toBeNull()
})
it('filters user rejected request errors', () => {
const originalException = new Error('user rejected transaction')
expect(filterKnownErrors(ERROR, { originalException })).toBeNull()
})
it('filters invalid HTML response errors', () => {
const originalException = new SyntaxError("Unexpected token '<'")
expect(filterKnownErrors(ERROR, { originalException })).toBeNull()
......
import { ClientOptions, ErrorEvent, EventHint } from '@sentry/types'
import { didUserReject } from 'utils/swapErrorToUserReadableMessage'
// `responseStatus` is only currently supported on certain browsers.
// see: https://caniuse.com/mdn-api_performanceresourcetiming_responsestatus
......@@ -80,9 +79,6 @@ export const filterKnownErrors: Required<ClientOptions>['beforeSend'] = (event:
// If the error is a network change, it should not be considered an exception.
if (error.message.match(/underlying network changed/)) return null
// If the error is based on a user rejecting, it should not be considered an exception.
if (didUserReject(error)) return null
// This is caused by HTML being returned for a chunk from Cloudflare.
// Usually, it's the result of a 499 exception right before it, which should be handled.
// Therefore, this can be ignored.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment