Commit 8d32e315 authored by Vignesh Mohankumar's avatar Vignesh Mohankumar Committed by GitHub

feat: filter moz-extension errors (#6781)

parent 1c8b3f03
...@@ -76,15 +76,27 @@ describe('beforeSend', () => { ...@@ -76,15 +76,27 @@ describe('beforeSend', () => {
expect(beforeSend(ERROR, { originalException })).toBeNull() expect(beforeSend(ERROR, { originalException })).toBeNull()
}) })
it('filters chrome-extension errors', () => { describe('filters browser extension errors', () => {
const originalException = new Error() it('filters chrome-extension errors', () => {
originalException.stack = ` const originalException = new Error()
TypeError: Cannot create proxy with a non-object as target or handler originalException.stack = `
at pa(chrome-extension://kbjhmlgclljgdhmhffjofbobmficicjp/proxy-window-evm.a5430696.js:22:216604) TypeError: Cannot create proxy with a non-object as target or handler
at da(chrome-extension://kbjhmlgclljgdhmhffjofbobmficicjp/proxy-window-evm.a5430696.js:22:212968) at pa(chrome-extension://kbjhmlgclljgdhmhffjofbobmficicjp/proxy-window-evm.a5430696.js:22:216604)
at a(../../../../src/helpers.ts:98:1) at da(chrome-extension://kbjhmlgclljgdhmhffjofbobmficicjp/proxy-window-evm.a5430696.js:22:212968)
` at a(../../../../src/helpers.ts:98:1)
expect(beforeSend(ERROR, { originalException })).toBeNull() `
expect(beforeSend(ERROR, { originalException })).toBeNull()
})
it('filters moz-extension errors', () => {
const originalException = new Error()
originalException.stack = `
Error: Permission denied to access property "apply"
at WINDOW.onunhandledrejection(../node_modules/@sentry/src/instrument.ts:610:1)
at y/h.onunhandledrejection(moz-extension://95cafb7b-6038-4bdd-b832-d3a58544601d/content_script/inpage_sol.js:143:16274)
`
expect(beforeSend(ERROR, { originalException })).toBeNull()
})
}) })
describe('OneKey', () => { describe('OneKey', () => {
......
...@@ -58,9 +58,9 @@ function shouldRejectError(error: EventHint['originalException']) { ...@@ -58,9 +58,9 @@ function shouldRejectError(error: EventHint['originalException']) {
// Therefore, this can be ignored. // Therefore, this can be ignored.
if (error.message.match(/Unexpected token '<'/)) return true if (error.message.match(/Unexpected token '<'/)) return true
// Errors coming from a Chrome Extension can be ignored for now. These errors are usually caused by extensions injecting // Errors coming from a browser extension can be ignored. These errors are usually caused by extensions injecting
// scripts into the page, which we cannot control. // scripts into the page, which we cannot control.
if (error.stack?.match(/chrome-extension:\/\//i)) return true if (error.stack?.match(/-extension:\/\//i)) return true
// Errors coming from OneKey (a desktop wallet) can be ignored for now. // 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. // These errors are either application-specific, or they will be thrown separately outside of OneKey.
......
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