LedgerHQ / ledgerjs

⛔️ MOVED to monorepo "ledger-live"
https://github.com/LedgerHQ/ledger-live
Apache License 2.0
574 stars 375 forks source link

LIVE-545 Add Invalid channel to the list of disconnected errors #857

Closed grsoares21 closed 2 years ago

grsoares21 commented 2 years ago

A common error that might happen when a device is abruptly disconnected from USB during an exchange is the "Invalid channel" error.

Defined at android/src/main/java/com/ledgerwallet/hid/LedgerHelper.java at lines 82, 85, 54 and 57.

This PR adds this error to a list of errors that get caught and mapped to a DisconnectedDevice type of error. This provides a cleaner wording for the user explaining that the device was disconnected and the user should retry the operation. Without it, the error that is displayed to the user states only "Invalid channel" which doesn't mean much and isn't even translated.

PS.: For now, a manual mapping was added in LLM in https://github.com/LedgerHQ/ledger-live-mobile/pull/2432 . After this is merged and all upgrades are done to LLC and then LLM, that manual mapping can be removed.

codecov[bot] commented 2 years ago

Codecov Report

Merging #857 (ea8c5bd) into master (ae240fb) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #857   +/-   ##
=======================================
  Coverage   43.56%   43.56%           
=======================================
  Files          81       81           
  Lines        4823     4823           
  Branches      791      770   -21     
=======================================
  Hits         2101     2101           
- Misses       2705     2708    +3     
+ Partials       17       14    -3     
Impacted Files Coverage Δ
packages/react-native-hid/src/index.ts 0.00% <ø> (ø)
packages/hw-transport-http/src/HttpTransport.ts 0.00% <0.00%> (ø)
...ckages/hw-transport-http/src/WebSocketTransport.ts 0.00% <0.00%> (ø)
...s/react-native-hw-transport-ble/src/awaitsBleOn.ts 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ae240fb...ea8c5bd. Read the comment docs.

ghost commented 2 years ago

Hi @grsoares21 do you want to migrate this work to the monorepo, or should we close it?

grsoares21 commented 2 years ago

@haammar-ledger I'm closing this. I've already migrated it to the mono repo in the same PR as the firmware update.