trezor: close trezor suite on failure to acquire

This commit is contained in:
tobtoht 2024-01-02 14:53:39 +01:00
parent 35f0ee406c
commit efae6ae70f
No known key found for this signature in database
GPG key ID: E45B10DD027D2472

View file

@ -270,7 +270,12 @@ void WindowManager::onWalletOpened(Wallet *wallet) {
errMsg = QString("%1\n\nAttempted to clean wallet cache. Please restart Feather.").arg(errMsg); errMsg = QString("%1\n\nAttempted to clean wallet cache. Please restart Feather.").arg(errMsg);
this->handleWalletError({nullptr, Utils::ERROR, "Unable to open wallet", errMsg}); this->handleWalletError({nullptr, Utils::ERROR, "Unable to open wallet", errMsg});
} else { } else {
this->handleWalletError({nullptr, Utils::ERROR, "Unable to open wallet", errMsg}); QStringList helpItems = {};
if (errMsg == "Failed to acquire device") {
helpItems.append("Try closing Trezor suite");
}
this->handleWalletError({nullptr, Utils::ERROR, "Unable to open wallet", errMsg, helpItems});
} }
return; return;
} }
@ -340,7 +345,7 @@ void WindowManager::tryCreateWallet(Seed seed, const QString &path, const QStrin
} }
if (seed.mnemonic.isEmpty()) { if (seed.mnemonic.isEmpty()) {
this->handleWalletError({nullptr, Utils::ERROR, "Failed to create wallet", "Mnemonic seed is emopty"}); this->handleWalletError({nullptr, Utils::ERROR, "Failed to create wallet", "Mnemonic seed is empty"});
return; return;
} }
@ -455,6 +460,9 @@ void WindowManager::onWalletCreated(Wallet *wallet) {
link = "https://wiki.trezor.io/Udev_rules"; link = "https://wiki.trezor.io/Udev_rules";
#endif #endif
} }
else if (error.contains("Failed to acquire device")) {
helpItems = {"Try closing Trezor suite"};
}
if (error.contains("SW_CLIENT_NOT_SUPPORTED")) { if (error.contains("SW_CLIENT_NOT_SUPPORTED")) {
helpItems = {"Upgrade your Ledger device firmware to the latest version using Ledger Live.\n" helpItems = {"Upgrade your Ledger device firmware to the latest version using Ledger Live.\n"
"Then upgrade the Monero app for the Ledger device to the latest version."}; "Then upgrade the Monero app for the Ledger device to the latest version."};