Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: filter errors with OneKey in stack #6477

Merged
merged 2 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: filter errors with OneKey in stack
  • Loading branch information
vm committed May 1, 2023
commit f625128e43fa3f54506886c5406c6d7b7a370f4d
7 changes: 5 additions & 2 deletions src/tracing/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ describe('filterKnownErrors', () => {
})
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>)
at _d._handleAccountChange(/Applications/OneKey.app/Contents/Resources/static/preload.js:2:1634067)
`
expect(filterKnownErrors(ERROR, { originalException })).toBeNull()
})
})
Expand Down
2 changes: 1 addition & 1 deletion src/tracing/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down