chore: track all errors in handle middleware WPN-1451#632
Open
taran-a wants to merge 6 commits into
Open
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 8406c25. Configure here.
Battambang
previously approved these changes
Jun 24, 2026
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
* chore: track errors in AssetsUseCases * chore: track errors in SendFlowUseCases * chore: track errors in Assets, Cron, Keyring, and Rpc handlers * chore: comment suppressed errors intent in mappings
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Explanation
Improves Snap observability and trace handling by centralizing error/event tracking resilience in
SnapClientAdapter, broadeningHandlerMiddlewareto track unexpected errors, and skipping tracking for user-canceled confirmations. It also simplifies callers by removingrunSnapActionSafely, updates trace semantics soendTraceonly runs whenstartTracesucceeds, and adds/refreshes tests covering the new tracking and tracing behavior.References
Checklist
Note
Medium Risk
Touches cross-cutting error/telemetry paths and cron partial-sync behavior; failures in tracking are swallowed (by design) which could hide telemetry outages but should not block user flows.
Overview
Improves Bitcoin Snap observability by making telemetry non-fatal and tracking more consistent across handlers and use cases.
SnapClientAdapternow takes aLogger, wrapssnap_trackEvent,snap_trackError,snap_startTrace, andsnap_endTracein try/catch (log on failure, never throw), sends errors viagetJsonError, and changesstartTraceto returnbooleanso callers only callendTracewhen start succeeded.HandlerMiddlewaretracks errors before translation/wrapping for any thrown error via newshouldTrackError(skips "User canceled the confirmation").BaseError-only tracking in the middleware catch path is removed in favor of this broader path.Call sites drop
runSnapActionSafelyand call tracking directly;emitTrackingErroris wired into asset price/historical failures, partial cron sync failures, keyring address resolution failures, send-flow/confirmation graceful fallbacks, and related paths. User-input validation (RPC address/amount, some send-form fields) stays untracked by design.SnapClienttypes updateemitTrackingErrorto acceptErrorand document the new trace return type. Tests cover adapter resilience, middleware tracking rules, and updated trace behavior.Reviewed by Cursor Bugbot for commit 3e84cde. Bugbot is set up for automated code reviews on this repo. Configure here.