diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index a61d51e17..48f516bc5 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -1286,6 +1286,9 @@ "message": "Customize how you connect your Ledger to MetaMask. $1 is recommended, but other options are available. Read more here: $2", "description": "A description that appears above a dropdown where users can select between up to three options - Ledger Live, U2F or WebHID - depending on what is supported in their browser. $1 is the recommended browser option, it will be either WebHID or U2f. $2 is a link to an article where users can learn more, but will be the translation of the learnMore message." }, + "ledgerDeviceOpenFailureMessage": { + "message": "The Ledger device failed to open. Your Ledger might be connected to other software. Please close Ledger Live or other applications connected to your Ledger device, and try to connect again." + }, "ledgerLive": { "message": "Ledger Live", "description": "The name of a desktop app that can be used with your ledger device. We can also use it to connect a users Ledger device to MetaMask." diff --git a/ui/store/actions.js b/ui/store/actions.js index b3841fbc8..e23781079 100644 --- a/ui/store/actions.js +++ b/ui/store/actions.js @@ -402,14 +402,14 @@ export function forgetDevice(deviceName) { export function connectHardware(deviceName, page, hdPath, t) { log.debug(`background.connectHardware`, deviceName, page, hdPath); return async (dispatch, getState) => { + const { ledgerTransportType } = getState().metamask; + dispatch( showLoadingIndication(`Looking for your ${capitalize(deviceName)}...`), ); let accounts; try { - const { ledgerTransportType } = getState().metamask; - if (deviceName === 'ledger') { await promisifiedBackground.establishLedgerTransportPreference(); } @@ -435,8 +435,16 @@ export function connectHardware(deviceName, page, hdPath, t) { ); } catch (error) { log.error(error); - dispatch(displayWarning(error.message)); - throw error; + if ( + deviceName === 'ledger' && + ledgerTransportType === LEDGER_TRANSPORT_TYPES.WEBHID && + error.message.match('Failed to open the device') + ) { + dispatch(displayWarning(t('ledgerDeviceOpenFailureMessage'))); + } else { + dispatch(displayWarning(error.message)); + throw error; + } } finally { dispatch(hideLoadingIndication()); }