Commit c2a972eb authored by Vignesh Mohankumar's avatar Vignesh Mohankumar Committed by GitHub

fix: filter chrome-extension errors (#6475)

* fix: filter chrome-extension errors in Sentry

* check stack
parent 47a2768d
......@@ -40,6 +40,17 @@ describe('filterKnownErrors', () => {
expect(filterKnownErrors(ERROR, { originalException })).toBeNull()
})
it('filters chrome-extension errors', () => {
const originalException = new Error()
originalException.stack = `
TypeError: Cannot create proxy with a non-object as target or handler
at pa(chrome-extension://kbjhmlgclljgdhmhffjofbobmficicjp/proxy-window-evm.a5430696.js:22:216604)
at da(chrome-extension://kbjhmlgclljgdhmhffjofbobmficicjp/proxy-window-evm.a5430696.js:22:212968)
at a(../../../../src/helpers.ts:98:1)
`
expect(filterKnownErrors(ERROR, { originalException })).toBeNull()
})
describe('OneKey', () => {
it('filter OneKey errors (macOS users)', () => {
const originalException = new Error()
......
......@@ -76,6 +76,10 @@ export const filterKnownErrors: Required<ClientOptions>['beforeSend'] = (event:
// Therefore, this can be ignored.
if (error.message.match(/Unexpected token '<'/)) return null
// Errors coming from a Chrome Extension can be ignored for now. These errors are usually caused by extensions injecting
// scripts into the page, which we cannot control.
if (error.stack?.match(/chrome-extension:\/\//i)) return null
// Errors coming from OneKey (a desktop wallet) can be ignored for now.
// These errors are either application-specific, or they will be thrown separately outside of OneKey.
if (error.stack?.match(/OneKey/i)) return null
......
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