fix: filter errors with OneKey in stack (#6477)
* fix: filter errors with OneKey in stack * check stack
This commit is contained in:
parent
ff0209a78f
commit
607d0d443e
@ -43,13 +43,20 @@ describe('filterKnownErrors', () => {
|
||||
describe('OneKey', () => {
|
||||
it('filter OneKey errors (macOS users)', () => {
|
||||
const originalException = new Error()
|
||||
originalException.name = 'xd.<anonymous>(/Applications/OneKey.app/Contents/Resources/static/preload.js)'
|
||||
originalException.stack = `
|
||||
SyntaxError: Unexpected token u in JSON at position 0
|
||||
at JSON.parse(<anonymous>)
|
||||
at _d._handleAccountChange(/Applications/OneKey.app/Contents/Resources/static/preload.js:2:1634067)
|
||||
`
|
||||
expect(filterKnownErrors(ERROR, { originalException })).toBeNull()
|
||||
})
|
||||
it('filter OneKey errors (Windows users)', () => {
|
||||
const originalException = new Error()
|
||||
originalException.name =
|
||||
'yd.<anonymous>(C:\\Users\\xyz\\AppData\\Local\\Programs\\OneKey\\resources\\static\\preload.js)'
|
||||
originalException.stack = `
|
||||
SyntaxError: Unexpected token u in JSON at position 0
|
||||
at JSON.parse(<anonymous>)
|
||||
vd._handleAccountChange(C:\\Users\\example\\AppData\\Local\\Programs\\OneKey\\resources\\static\\preload.js:2:1626130
|
||||
`
|
||||
expect(filterKnownErrors(ERROR, { originalException })).toBeNull()
|
||||
})
|
||||
})
|
||||
|
@ -89,7 +89,7 @@ export const filterKnownErrors: Required<ClientOptions>['beforeSend'] = (event:
|
||||
* 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.name.match(/OneKey/i)) return null
|
||||
if (error.stack?.match(/OneKey/i)) return null
|
||||
|
||||
/*
|
||||
* Content security policy 'unsafe-eval' errors can be filtered out because there are expected failures.
|
||||
|
Loading…
Reference in New Issue
Block a user