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

feat: filter moz-extension errors (#6781)

parent 1c8b3f03
...@@ -76,6 +76,7 @@ describe('beforeSend', () => { ...@@ -76,6 +76,7 @@ describe('beforeSend', () => {
expect(beforeSend(ERROR, { originalException })).toBeNull() expect(beforeSend(ERROR, { originalException })).toBeNull()
}) })
describe('filters browser extension errors', () => {
it('filters chrome-extension errors', () => { it('filters chrome-extension errors', () => {
const originalException = new Error() const originalException = new Error()
originalException.stack = ` originalException.stack = `
...@@ -87,6 +88,17 @@ describe('beforeSend', () => { ...@@ -87,6 +88,17 @@ describe('beforeSend', () => {
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', () => {
it('filter OneKey errors (macOS users)', () => { it('filter OneKey errors (macOS users)', () => {
const originalException = new Error() const originalException = new Error()
......
...@@ -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