Skip to content

Commit

Permalink
Handle DeviceDisconnected Error
Browse files Browse the repository at this point in the history
This happens during operations occasionally when the transport fails.
  • Loading branch information
NullSoldier committed Oct 8, 2024
1 parent e722119 commit 0fdc529
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ironfish-cli/src/ledger/ledger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
import { Assert } from '@ironfish/sdk'
import { StatusCodes, TransportStatusError } from '@ledgerhq/errors'
import {
DisconnectedDeviceDuringOperation,
StatusCodes,
TransportStatusError,
} from '@ledgerhq/errors'
import TransportNodeHid from '@ledgerhq/hw-transport-node-hid'
import IronfishApp, {
KeyResponse,
Expand Down Expand Up @@ -45,6 +49,8 @@ export class Ledger {
throw new LedgerPortIsBusyError()
} else if (LedgerConnectError.IsError(e)) {
throw new LedgerConnectError()
} else if (e instanceof DisconnectedDeviceDuringOperation) {
throw new LedgerConnectError()
}

if (error instanceof TransportStatusError) {
Expand Down

0 comments on commit 0fdc529

Please sign in to comment.