Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/hw-wallet-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add `DeviceUnresponsive` error code and Ledger mapping for unresponsive device state ([#442](https://github.com/MetaMask/accounts/pull/442))

## [0.1.0]

### Added
Expand Down
10 changes: 10 additions & 0 deletions packages/hw-wallet-sdk/src/hardware-error-mappings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ describe('HARDWARE_ERROR_MAPPINGS', () => {
});
});

describe('device state errors', () => {
it('maps 0x6f00 to device unresponsive', () => {
const mapping = errorMappings['0x6f00'];
expect(mapping.code).toBe(ErrorCode.DeviceUnresponsive);
expect(mapping.severity).toBe(Severity.Err);
expect(mapping.category).toBe(Category.DeviceState);
expect(mapping.userMessage).toContain('not responding');
});
});

it('has valid structure for all mappings', () => {
Object.entries(errorMappings).forEach(([_, mapping]) => {
expect(mapping).toHaveProperty('code');
Expand Down
8 changes: 8 additions & 0 deletions packages/hw-wallet-sdk/src/hardware-error-mappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ export const LEDGER_ERROR_MAPPINGS = {
category: Category.DeviceState,
userMessage: 'Ethereum app is out of date. Please update it to continue.',
},
'0x6f00': {
code: ErrorCode.DeviceUnresponsive,
message: 'Device unresponsive',
severity: Severity.Err,
category: Category.DeviceState,
userMessage:
'Your device is not responding. Please disconnect and reconnect your device.',
},
};

export const BLE_ERROR_MAPPINGS = {
Expand Down
1 change: 1 addition & 0 deletions packages/hw-wallet-sdk/src/hardware-errors-enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export enum ErrorCode {
DeviceDisconnected = 3003,
DeviceUsedElsewhere = 3004,
DeviceCallInProgress = 3005,
DeviceUnresponsive = 3006,
DeviceNotFound = 3010,
DeviceMultipleConnected = 3011,
DeviceMissingCapability = 3020,
Expand Down
Loading