Skip to content

Conversation

@montelaidev
Copy link
Contributor

@montelaidev montelaidev commented Jan 8, 2026

This PR adds new hardware errors and error codes to the @metamask/hw-device-sdk.

See: https://consensyssoftware.atlassian.net/browse/MUL-1304?atlOrigin=eyJpIjoiZmYwZmRmNDg1NDkzNDMxMjg2ZTBmNmUwYzQzZTA2ZjgiLCJwIjoiaiJ9

Examples


Note

Adds a structured hardware error system and Ledger code mappings to hw-device-sdk.

  • Introduces ErrorCode, Severity, and Category enums for consistent error typing
  • Implements HardwareWalletError with unique IDs, user-friendly messages, metadata support, toJSON, toString, toDetailedString, and helpers (isCritical, isWarning, withMetadata)
  • Adds LEDGER_ERROR_MAPPINGS mapping Ledger status codes (e.g., 0x9000, 0x6985, 0x9840) to internal ErrorCode/Severity/Category with optional userMessage
  • Exposes new modules via src/index.ts; removes placeholder test
  • Provides comprehensive unit tests for mappings and error behavior; updates CHANGELOG.md

Written by Cursor Bugbot for commit 887c781. This will update automatically on new commits. Configure here.

@montelaidev montelaidev self-assigned this Jan 8, 2026
@montelaidev montelaidev requested a review from a team as a code owner January 8, 2026 05:07
@montelaidev montelaidev enabled auto-merge January 8, 2026 10:17
Co-authored-by: Charly Chevalier <[email protected]>
Comment on lines +29 to +32
DeviceMultipleConnected = 3011,
DeviceMissingCapability = 3020,
DeviceBtcOnlyFirmware = 3021,
DeviceIncompatibleMode = 3030,
Copy link
Contributor

Choose a reason for hiding this comment

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

The sub-sections seem wrong. But we can fix them up later.

@ccharly ccharly disabled auto-merge January 14, 2026 11:32
@ccharly ccharly enabled auto-merge January 14, 2026 11:32
@ccharly ccharly added this pull request to the merge queue Jan 14, 2026
Merged via the queue into main with commit 40901bb Jan 14, 2026
41 checks passed
@ccharly ccharly deleted the feat/hardware-errors-keyring-utils branch January 14, 2026 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants