Skip to content

Commit e7fd691

Browse files
lukaw3dlukaw3d
authored andcommitted
Differentiate errors in ExtLedgerAccessPopup
1 parent 698ffc5 commit e7fd691

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

extension/src/ExtLedgerAccessPopup/ExtLedgerAccessPopup.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ import { StatusGood } from 'grommet-icons/es6/icons/StatusGood'
99
import { Header } from 'app/components/Header'
1010
import { ErrorFormatter } from 'app/components/ErrorFormatter'
1111
import { AlertBox } from 'app/components/AlertBox'
12-
import { WalletErrors } from 'types/errors'
12+
import { WalletError } from 'types/errors'
1313
import logotype from '../../../public/Icon Blue 192.png'
1414
import { CountdownButton } from 'app/components/CountdownButton'
1515
import { getUSBTransport } from '../../../src/app/state/importaccounts/saga'
1616
import { runSaga } from 'redux-saga'
1717

18-
type ConnectionStatus = 'connected' | 'disconnected' | 'connecting' | 'error'
18+
type ConnectionStatus = 'connected' | 'disconnected' | 'connecting' | WalletError
1919
type ConnectionStatusIconPros = {
2020
success?: boolean
2121
label: string
@@ -54,8 +54,8 @@ export function ExtLedgerAccessPopup() {
5454
// Used to redirect after reopening wallet
5555
window.localStorage.setItem('oasis_wallet_granted_usb_ledger_timestamp', Date.now().toString())
5656
setTimeout(() => window.close(), 5_000)
57-
} catch {
58-
setConnection('error')
57+
} catch (e) {
58+
setConnection(e as WalletError)
5959
}
6060
}
6161

@@ -106,15 +106,15 @@ export function ExtLedgerAccessPopup() {
106106
/>
107107
</Box>
108108
)}
109-
{connection === 'error' && (
109+
{connection instanceof WalletError && (
110110
<Box margin={{ bottom: 'medium' }}>
111111
<ConnectionStatusIcon
112112
success={false}
113113
label={t('ledger.extension.failed', 'Connection failed')}
114114
withMargin
115115
/>
116116
<AlertBox status="error">
117-
<ErrorFormatter code={WalletErrors.LedgerNoDeviceSelected} />
117+
<ErrorFormatter code={connection.type} message={connection.message} />
118118
</AlertBox>
119119
</Box>
120120
)}

0 commit comments

Comments
 (0)