Skip to content

Commit

Permalink
fix(trezor): display correct message for connection error (cowprotoco…
Browse files Browse the repository at this point in the history
  • Loading branch information
shoom3301 authored Mar 6, 2024
1 parent 102f2ad commit dbb0ea7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ export class TrezorConnector extends Connector {
}

private getCurrentAccount(): string {
if (!this.accounts) {
throw new Error('Cannot load Trezor accounts')
if (!this.accounts || this.accounts.length === 0) {
throw new Error('Cannot load Trezor accounts. Make sure that the Trezor device is connected.')
}

const currentAccountIndex = getHwAccount().index
const account = this.accounts[currentAccountIndex]

if (!account) {
throw new Error('Current Trezor account index is out of bounds')
throw new Error('Current Trezor account index is out of bounds.')
}

return account
Expand Down

0 comments on commit dbb0ea7

Please sign in to comment.