Skip to content

fix: prevent reporting to Sentry an error when the user rejects a tx in the wallet#321

Merged
aleortega merged 4 commits intomainfrom
fix/user-rejected-tx
Mar 6, 2026
Merged

fix: prevent reporting to Sentry an error when the user rejects a tx in the wallet#321
aleortega merged 4 commits intomainfrom
fix/user-rejected-tx

Conversation

@aleortega
Copy link
Copy Markdown
Contributor

@aleortega aleortega commented Mar 5, 2026

Silence Sentry alerts for user-rejected wallet interactions

When a user rejects a transaction or signature in their wallet (e.g. MetaMask), the error was being reported to Sentry as an application error. These are expected user actions, not bugs.

This manifests differently depending on the page and library path:

  • RequestPage (signing/transactions): viem throws code 4001, or decentraland-transactions wraps it as MetaTransactionError with code unknown (library bug — only recognizes the old ethers-era message for user_denied)
  • LoginPage (identity signing): decentraland-connect returns an ethers BrowserProvider that intercepts the raw 4001 and wraps it as ACTION_REJECTED before viem sees it

This PR:

  • Adds isUserRejectedTransaction() in src/shared/errors.ts that detects all 4 wallet rejection error shapes: viem 4001, ethers ACTION_REJECTED, decentraland-transactions user_denied, and decentraland-transactions unknown with exact message match
  • RequestPage: both onApproveSignInVerification and onApproveWalletInteraction catch blocks now handle wallet rejections the same way as the existing Deny button — skip Sentry, send failed outcome to auth server, show the denied view
  • LoginPage: handleOnConnect catch block skips Sentry for wallet rejections while still showing the "You did not confirm this action" modal (correct UX, just shouldn't be an alert)

All silenced rejections log a console.info breadcrumb for visibility.

Use Case Summary:

  1. This prevents reporting an error when a user cancels a gift from /auth/request page
  2. This prevents reporting an error when a user cancels log-in transaction

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
auth Ready Ready Preview, Comment Mar 6, 2026 2:33pm

Request Review

Copy link
Copy Markdown
Collaborator

@LautaroPetaccio LautaroPetaccio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Comment thread src/components/Pages/RequestPage/RequestPage.tsx Outdated
Comment thread src/shared/errors.ts
if (error === null || typeof error !== 'object') return false

const code = (error as { code: unknown }).code
// viem UserRejectedRequestError (EIP-1193)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about handling the 4100 error here https://eips.ethereum.org/EIPS/eip-1193 as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TKM! I am on it!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After iterating this with the model we think this should be handled differently mostly because this 4100 error can be thrown when the wallet is not unlocked and can be related to other kind of errors/bugs. Will handle this in a new PR!

@aleortega aleortega force-pushed the fix/user-rejected-tx branch from 85fcb2d to fcc3571 Compare March 6, 2026 14:32
@aleortega aleortega merged commit dc205c5 into main Mar 6, 2026
9 checks passed
@aleortega aleortega deleted the fix/user-rejected-tx branch March 6, 2026 14:46
braianj pushed a commit that referenced this pull request Mar 6, 2026
…in the wallet (#321)

* fix: prevent reporting to Sentry an error when the user rejects a tx in the wallet

* fix: user rejected_action report to Sentry

* refactor: PR feedback

* chore: indent comment
braianj added a commit that referenced this pull request Mar 6, 2026
* feat: add email-only sign-in option with dynamic wallet ordering

* fix: make email handlers optional and default feature flags to false for mobile compatibility

* refactor: usage of sign in option variants

* test: update

* refactor: connetion buttons

* refactor: sort imports

* test: fix

* fix: Incorrect handling of callback and magic re-log in (#325)

* fix: Incorrect handling of callback and magic re-log in

* fix: Ignore error

* Ignore MISSING_PKCE_METADATA error

* fix: Cannot read properties of null (reading length) (#327)

* fix: prevent reporting to Sentry an error when the user rejects a tx in the wallet (#321)

* fix: prevent reporting to Sentry an error when the user rejects a tx in the wallet

* fix: user rejected_action report to Sentry

* refactor: PR feedback

* chore: indent comment

* feat: Add test-ids-to elements for E2E testing (#330)

* fix: SSO log-in with Magic by waiting for redirect url before trying to extract params (#329)

* fix: SSO log-in with Magic by waiting for redirect url before trying to extract params

* fix: apply PR feedback

---------

Co-authored-by: Lautaro Petaccio <1120791+LautaroPetaccio@users.noreply.github.com>

* fix: Avatar particles image size (#332)

* feat: Asynchronously load OTP to reduce start time (#331)

* feat: Asynchronously load OTP to reduce start time

* fix: Linting

* fix: Thirdweb fixed version

* fix: Invalid method (#333)

* chore: update package.lock.js

* fix: preserve non-EMAIL primary option (mobile flow) in useWalletOptions hook and fix 'more options' visibility

---------

Co-authored-by: Lautaro Petaccio <1120791+LautaroPetaccio@users.noreply.github.com>
Co-authored-by: Alejo Thomas Ortega <alejothomasortega@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants