Skip to content

chore: in development, show deposit and withdraw errors in money account#30670

Merged
shane-t merged 20 commits into
mainfrom
shane-t/money-account-error-handling
Jun 3, 2026
Merged

chore: in development, show deposit and withdraw errors in money account#30670
shane-t merged 20 commits into
mainfrom
shane-t/money-account-error-handling

Conversation

@shane-t

@shane-t shane-t commented May 27, 2026

Copy link
Copy Markdown
Member

Description

  • In dev, exp and rc, show an alert with the error that can be copied

Changelog

CHANGELOG entry: null

Related issues

Fixes: N/A

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

N/A

After

NA
Simulator Screenshot - iPhone 16e - 2026-06-03 at 12 04 13

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Developer-facing diagnostics only; production users see no new UI, and transaction error handling still logs and rethrows as before.

Overview
Adds showDevErrorAlert, a dev/rc/exp/test-only helper that shows a native alert with the error stack and a Copy action (via ClipboardManager). It no-ops in production and skips the standard “user denied transaction signature” message.

useMoneyAccount now calls this helper alongside existing Logger.error when addTransactionBatch fails for deposit or withdrawal; errors are still rethrown for callers.

Unit tests cover environment gating, suppression, copy behavior, and hook integration expectations.

Reviewed by Cursor Bugbot for commit 3d9346a. Bugbot is set up for automated code reviews on this repo. Configure here.

@shane-t shane-t marked this pull request as ready for review May 27, 2026 09:17
@shane-t shane-t requested a review from a team as a code owner May 27, 2026 09:17
Comment thread app/components/UI/Money/components/MoneyAddMoneySheet/MoneyAddMoneySheet.tsx Outdated
Comment thread app/components/UI/Money/hooks/useMoneyAccount.ts
shane-t added 2 commits May 27, 2026 10:38
Jwhiles
Jwhiles previously approved these changes May 27, 2026
Comment thread app/components/UI/Money/hooks/useMoneyAccount.test.ts
Jwhiles
Jwhiles previously approved these changes May 27, 2026
@sonarqubecloud

Copy link
Copy Markdown

Comment thread app/components/UI/Money/components/MoneyAddMoneySheet/MoneyAddMoneySheet.test.tsx Outdated
Comment thread app/components/UI/Money/hooks/useMoneyAccount.ts Outdated
Jwhiles
Jwhiles previously approved these changes May 29, 2026
Co-authored-by: John Whiles <johnwhiles@outlook.com>
Comment thread app/components/UI/Money/hooks/useMoneyAccount.ts
Comment thread app/components/UI/Money/hooks/useMoneyAccount.ts
Comment thread app/components/UI/Money/components/MoneyAddMoneySheet/MoneyAddMoneySheet.tsx Outdated
Comment thread app/components/UI/Money/components/MoneyOnboardingCard/MoneyOnboardingCard.tsx Outdated
@github-actions github-actions Bot added the risk:medium AI analysis: medium risk label Jun 3, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 59fdeda. Configure here.

Comment thread app/components/UI/Money/components/MoneyAddMoneySheet/MoneyAddMoneySheet.tsx Outdated
@shane-t shane-t changed the title chore: capture errors occuring during withdraw and deposit to money account chore: in development, show deposit and withdraw errors in money account Jun 3, 2026
Kureev
Kureev previously approved these changes Jun 3, 2026
@shane-t shane-t enabled auto-merge June 3, 2026 12:48
Kureev
Kureev previously approved these changes Jun 3, 2026
@shane-t shane-t requested a review from Kureev June 3, 2026 13:27
@Matt561 Matt561 self-requested a review June 3, 2026 13:37
Matt561
Matt561 previously approved these changes Jun 3, 2026
@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeMoney
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 95%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are entirely scoped to the Money/Card feature area (app/components/UI/Money/):

  1. devErrorAlert.ts (new file): A developer-only utility that shows a native Alert with error stack traces. It is strictly gated by METAMASK_ENVIRONMENT to non-production environments (rc/exp/dev/test) and suppresses expected user-cancellation errors. This has zero impact on production behavior.

  2. useMoneyAccount.ts: Adds showDevErrorAlert calls in the deposit and withdrawal error catch blocks. The core error handling logic (Logger.error + rethrow) is completely unchanged — this only adds a dev-only alert overlay on top of existing behavior.

  3. Test files: Unit tests covering the new utility and updated hook assertions.

The changes do not touch any shared components (navigation, confirmations, browser, accounts), core infrastructure, or controllers. The only E2E tests that could be affected are SmokeMoney tests that exercise the deposit/withdrawal flows in the Money/Card feature. No performance impact is expected since the alert is dev-only and adds no overhead to production builds.

Performance Test Selection:
No performance impact. The devErrorAlert utility is gated to non-production environments and adds no overhead to production builds. The deposit/withdrawal logic paths are unchanged in terms of execution flow.

View GitHub Actions results

@Matt561 Matt561 self-requested a review June 3, 2026 16:39
@shane-t shane-t added this pull request to the merge queue Jun 3, 2026
Merged via the queue into main with commit 0d2a7d0 Jun 3, 2026
185 of 189 checks passed
@shane-t shane-t deleted the shane-t/money-account-error-handling branch June 3, 2026 17:09
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

risk:medium AI analysis: medium risk size-M team-earn

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants