Skip to content

feat: move errors helpers into shared pkg - #241

Open
taran-a wants to merge 6 commits into
mainfrom
feat/move-errors-into-shared-pkg
Open

feat: move errors helpers into shared pkg#241
taran-a wants to merge 6 commits into
mainfrom
feat/move-errors-into-shared-pkg

Conversation

@taran-a

@taran-a taran-a commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Explanation

  • Add shared snap error utilities to the main package entry point
    • createWithCatchAndThrowSnapError for handler-boundary error catching, logging, and Snap RPC normalization
    • normalizeError for converting caught values into Snap RPC errors, with optional custom normalizers via createWithCatchAndThrowSnapError's normalizeErrorFn option
    • isSnapRpcError type guard and SnapRpcError union type

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 review from a team as code owners August 31, 2026 14:15
@taran-a
taran-a deployed to default-branch August 31, 2026 14:15 — with GitHub Actions Active
@taran-a
taran-a force-pushed the feat/move-errors-into-shared-pkg branch from db053d3 to bcb8156 Compare August 31, 2026 14:31
@taran-a
taran-a force-pushed the feat/move-errors-into-shared-pkg branch from bcb8156 to 2652df8 Compare August 31, 2026 14:33
@Battambang
Battambang requested a balanced review from Copilot August 31, 2026 19:30

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.

Pull request overview

Centralizes Snap RPC error normalization and tracking wrappers in snap-networks-utils for reuse across wallet Snaps.

Changes:

  • Adds shared error helpers, types, exports, and tests.
  • Migrates Stellar, Solana, and Tron error handling to shared utilities.
  • Updates tracking behavior, manifests, coverage configuration, and changelog.

Reviewed changes

Copilot reviewed 35 out of 35 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/tron-wallet-snap/src/utils/sensitiveErrors.ts Uses the shared RPC error guard.
packages/tron-wallet-snap/src/utils/errors.ts Binds Tron tracking to the shared wrapper.
packages/tron-wallet-snap/src/utils/errors.test.ts Updates wrapper integration tests.
packages/tron-wallet-snap/src/clients/snap/SnapClient.ts Skips tracking user rejections.
packages/tron-wallet-snap/src/clients/snap/SnapClient.test.ts Tests rejection suppression.
packages/tron-wallet-snap/snap.manifest.json Updates the bundle checksum.
packages/stellar-wallet-snap/src/utils/snap.ts Moves rejection filtering into tracking.
packages/stellar-wallet-snap/src/utils/errors.ts Adopts the shared wrapper and types.
packages/stellar-wallet-snap/src/utils/errors.test.ts Removes migrated utility tests.
packages/stellar-wallet-snap/src/services/transaction/TransactionSynchronizeService.ts Uses the consolidated tracker.
packages/stellar-wallet-snap/src/services/transaction/TransactionService.ts Uses the consolidated tracker.
packages/stellar-wallet-snap/src/services/transaction/simulation/simulators.ts Updates tracking documentation.
packages/stellar-wallet-snap/src/services/transaction-scan/TransactionScanService.ts Uses the consolidated tracker.
packages/stellar-wallet-snap/src/services/sync/SynchronizeService.ts Uses the consolidated tracker.
packages/stellar-wallet-snap/src/services/price/PriceService.ts Uses the consolidated tracker.
packages/stellar-wallet-snap/src/services/on-chain-account/OnChainAccountSynchronizeService.ts Uses the consolidated tracker.
packages/stellar-wallet-snap/src/services/on-chain-account/OnChainAccountSynchronizeService.test.ts Updates tracker spies.
packages/stellar-wallet-snap/src/handlers/keyring/base.ts Uses the consolidated tracker.
packages/stellar-wallet-snap/src/handlers/cronjob/trackTransaction.ts Uses the consolidated tracker.
packages/stellar-wallet-snap/src/handlers/clientRequest/signAndSendTransaction.ts Uses the consolidated tracker.
packages/stellar-wallet-snap/src/handlers/clientRequest/confirmSend.ts Uses the consolidated tracker.
packages/stellar-wallet-snap/src/handlers/clientRequest/confirmSend.test.ts Updates tracker assertions.
packages/stellar-wallet-snap/snap.manifest.json Updates the bundle checksum.
packages/solana-wallet-snap/src/core/utils/errors.ts Adopts shared error utilities.
packages/solana-wallet-snap/src/core/utils/errors.test.ts Updates tracking and wrapper tests.
packages/solana-wallet-snap/snap.manifest.json Updates the bundle checksum.
packages/snap-networks-utils/src/utils/logger/__mocks__/Logger.ts Adds a reusable logger mock.
packages/snap-networks-utils/src/utils/errors/snapRpcError.ts Defines shared RPC error detection and types.
packages/snap-networks-utils/src/utils/errors/index.ts Exports the error utilities.
packages/snap-networks-utils/src/utils/errors/errors.ts Implements normalization and wrapper creation.
packages/snap-networks-utils/src/utils/errors/errors.test.ts Tests shared error behavior.
packages/snap-networks-utils/src/index.ts Publishes utilities from the package root.
packages/snap-networks-utils/jest.config.js Excludes mocks from coverage.
packages/snap-networks-utils/CHANGELOG.md Documents the new public exports.
eslint-suppressions.json Removes obsolete suppressions.

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

Comment thread packages/stellar-wallet-snap/src/utils/errors.ts
@taran-a
taran-a force-pushed the feat/move-errors-into-shared-pkg branch from b449e00 to fc77f9f Compare September 1, 2026 10:55
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