Skip to content

feat: use shared trackError in stellar - #250

Open
taran-a wants to merge 4 commits into
mainfrom
feat/stellar-use-shared-track-error-util
Open

feat: use shared trackError in stellar#250
taran-a wants to merge 4 commits into
mainfrom
feat/stellar-use-shared-track-error-util

Conversation

@taran-a

@taran-a taran-a commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Explanation

Use shared trackError util in the stellar snap.

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

@taran-a
taran-a requested a review from a team as a code owner September 1, 2026 15:35
@taran-a
taran-a force-pushed the feat/shared-track-error-util branch from 8fa2cf2 to 7c14039 Compare September 2, 2026 08:58
@taran-a
taran-a requested a review from a team as a code owner September 2, 2026 08:58
@taran-a
taran-a force-pushed the feat/shared-track-error-util branch from 7c14039 to 84b9966 Compare September 2, 2026 08:59
Base automatically changed from feat/shared-track-error-util to main September 2, 2026 11:54
@taran-a
taran-a force-pushed the feat/stellar-use-shared-track-error-util branch from fa04df0 to 1c4e3b1 Compare September 2, 2026 12:33
@stanleyyconsensys
stanleyyconsensys requested a lite review from Copilot September 2, 2026 12:40

Copilot AI 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.

🟡 Changes recommended

There is an unused import in confirmSend.test.ts that is likely to fail lint/typecheck and should be removed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR migrates the Stellar snap’s error reporting to the shared @metamask/snap-networks-utils implementation, removing the snap-local trackError helper and wiring error tracking/normalization through createSnapErrorHandling.

Changes:

  • Replace local trackError implementation with createSnapErrorHandling({ getSnapProvider, logError }) in the Stellar snap error utilities.
  • Update call sites and tests to import/spy on trackError from utils/errors instead of utils/snap.
  • Refresh the snap manifest shasum to reflect the rebuilt bundle.
File summaries
File Description
packages/stellar-wallet-snap/src/utils/snap.ts Removes the local trackError implementation from snap utilities.
packages/stellar-wallet-snap/src/utils/errors.ts Introduces shared error handling via createSnapErrorHandling, exporting trackError + withCatchAndThrowSnapError.
packages/stellar-wallet-snap/src/utils/mocks/snap.ts Updates the snap utils mock to stop re-exporting the removed trackError.
packages/stellar-wallet-snap/src/services/on-chain-account/OnChainAccountSynchronizeService.test.ts Updates tests to spy on trackError from utils/errors.
packages/stellar-wallet-snap/src/handlers/keyring/base.ts Switches trackError import to utils/errors.
packages/stellar-wallet-snap/src/handlers/clientRequest/confirmSend.test.ts Updates tests to spy on trackError from utils/errors (and still mocks snap utils).
packages/stellar-wallet-snap/snap.manifest.json Updates bundle shasum for the new build output.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +52 to 54
import * as errorsUtils from '../../utils/errors';
import { logger } from '../../utils/logger';
import * as snapUtils from '../../utils/snap';

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.

this import is indeed used.

const trackTransactionAddedSpy = jest.spyOn(
    snapUtils,
    'trackTransactionAdded',
  );
  const trackTransactionRejectedSpy = jest.spyOn(
    snapUtils,
    'trackTransactionRejected',
  );
  const trackTransactionApprovedSpy = jest.spyOn(
    snapUtils,
    'trackTransactionApproved',
  );

@taran-a
taran-a force-pushed the feat/stellar-use-shared-track-error-util branch from 1c4e3b1 to c8cf0ea Compare September 2, 2026 15:17
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