Skip to content

chore: track error batch#635

Merged
taran-a merged 4 commits into
chore/trackError-in-HandleMiddlewarefrom
chore/trackError-batch
Jun 26, 2026
Merged

chore: track error batch#635
taran-a merged 4 commits into
chore/trackError-in-HandleMiddlewarefrom
chore/trackError-batch

Conversation

@taran-a

@taran-a taran-a commented Jun 25, 2026

Copy link
Copy Markdown

Explanation

Adds emitTrackingError coverage for operational failures across AssetsUseCases, SendFlowUseCases, and several handlers (Assets, Cron, Keyring, and Rpc), and updates tests accordingly.
It also documents an intentional exception in mappings.ts.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Adds observability only; existing catch-and-degrade behavior is preserved, with explicit exclusions for user-input validation to avoid noisy telemetry.

Overview
Wires SnapClient.emitTrackingError into operational failure paths across the Bitcoin snap so rate fetches, sync, send-flow, and keyring resolution issues surface in product telemetry without changing user-visible outcomes.

Assets: AssetsUseCases now takes SnapClient and reports spot/historical price API failures; AssetsHandler reports when historical price lookup fails after the use case throws.

Cron: syncSelectedAccounts emits a SynchronizationError (with the first rejection as cause) when some selected-account syncs fail, while still emitting events for successful accounts.

Send flow: SendFlowUseCases tracks failures for exchange-rate fetch, PSBT build on confirm, background rate refresh, missing send-form context on refresh, and recipient isMine parsing in confirmSendFlow. Comments mark paths left untracked as user input or form validation feedback (recipient/amount handlers, #computeFee, Rpc address/amount validation).

Keyring: resolveAccountAddress tracks errors before returning null.

Mappings: Comments document why script-to-address conversion failures are not tracked (expected non-address scripts, optional UTXO address field).

Tests and index.ts wiring updated for the new SnapClient dependency on AssetsUseCases / AssetsHandler.

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

@taran-a taran-a requested a review from a team as a code owner June 25, 2026 17:45

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

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 c2c9a37. Configure here.

undefined,
rejectedResults[0]?.reason,
),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sync batch drops failure details

Medium Severity

When several selected accounts fail to synchronize, the new emitTrackingError path builds a SynchronizationError with only rejectedResults[0]?.reason as cause and passes undefined for data, so failures after the first are not attached to the tracked error unlike synchronizeAccounts, which records per-account reasons in data.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c2c9a37. Configure here.

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.

The number of accounts rejected is logged so that might be enough logging if the first one is the only one detailed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I also think that it would be enough to know only a single reason

@taran-a taran-a merged commit 3e84cde into chore/trackError-in-HandleMiddleware Jun 26, 2026
18 checks passed
@taran-a taran-a deleted the chore/trackError-batch branch June 26, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants