chore: track error batch#635
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 c2c9a37. Configure here.
| undefined, | ||
| rejectedResults[0]?.reason, | ||
| ), | ||
| ); |
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit c2c9a37. Configure here.
There was a problem hiding this comment.
The number of accounts rejected is logged so that might be enough logging if the first one is the only one detailed.
There was a problem hiding this comment.
I also think that it would be enough to know only a single reason
3e84cde
into
chore/trackError-in-HandleMiddleware


Explanation
Adds
emitTrackingErrorcoverage for operational failures acrossAssetsUseCases,SendFlowUseCases, and several handlers (Assets,Cron,Keyring, andRpc), and updates tests accordingly.It also documents an intentional exception in
mappings.ts.References
Checklist
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.emitTrackingErrorinto 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:
AssetsUseCasesnow takesSnapClientand reports spot/historical price API failures;AssetsHandlerreports when historical price lookup fails after the use case throws.Cron:
syncSelectedAccountsemits aSynchronizationError(with the first rejection as cause) when some selected-account syncs fail, while still emitting events for successful accounts.Send flow:
SendFlowUseCasestracks failures for exchange-rate fetch, PSBT build on confirm, background rate refresh, missing send-form context on refresh, and recipientisMineparsing inconfirmSendFlow. Comments mark paths left untracked as user input or form validation feedback (recipient/amount handlers,#computeFee, Rpc address/amount validation).Keyring:
resolveAccountAddresstracks 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.tswiring updated for the newSnapClientdependency onAssetsUseCases/AssetsHandler.Reviewed by Cursor Bugbot for commit c2c9a37. Bugbot is set up for automated code reviews on this repo. Configure here.