Skip to content

Commit

Permalink
fix: Isuserrejected error when cause exists but undefined (#10666)
Browse files Browse the repository at this point in the history
<!--
Before opening a pull request, please read the [contributing
guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md)
first
-->


<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates error handling logic in `sentry.ts` and
`sentry.client.config.js` to check for the existence of `err.cause`
before accessing its properties.

### Detailed summary
- Updated error handling logic to check for `err.cause` existence before
accessing its properties.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
memoyil authored Sep 12, 2024
1 parent 60e552d commit 56c9beb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/web/sentry.client.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const isUserRejected = (err) => {
if (err && typeof err === 'object') {
if (
('code' in err && (err.code === 4001 || err.code === 'ACTION_REJECTED')) ||
('cause' in err && 'code' in err.cause && err.cause.code === 4001)
('cause' in err && err.cause && 'code' in err.cause && err.cause.code === 4001)
) {
return true
}
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/utils/sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const isUserRejected = (err) => {
if (err && typeof err === 'object') {
if (
('code' in err && (err.code === 4001 || err.code === 'ACTION_REJECTED')) ||
('cause' in err && 'code' in err.cause && err.cause.code === 4001)
('cause' in err && err.cause && 'code' in err.cause && err.cause.code === 4001)
) {
return true
}
Expand Down

0 comments on commit 56c9beb

Please sign in to comment.