CW-1143-Fix-Ledger-wallets-getting-corruption-popups (#2447)

* fix: handle errors differently if it is a ledger wallet * fix: improve ledger error code regex

Konstantin Ullrich committed Aug 12, 2025 at 15:39 UTC af35c281525738f0bddb5a38bc84102c76b3da90
2 files changed +2 -2
lib/core/wallet_loading_service.dart
+1 -1
@@ -74,7 +74,7 @@ class WalletLoadingService {
74 } catch (error, stack) {
75 await ExceptionHandler.resetLastPopupDate();
76 final isLedgerError = await ExceptionHandler.isLedgerError(error);
77 - if (isLedgerError) rethrow;
77 + if (isLedgerError || requireHardwareWalletConnection(type, name)) rethrow;
78 await ExceptionHandler.onError(FlutterErrorDetails(exception: error, stack: stack));
79
80
lib/view_model/hardware_wallet/ledger_view_model.dart
+1 -1
@@ -178,7 +178,7 @@ abstract class LedgerViewModelBase with Store {
178 return error;
179 }
180
181 - var errorRegex = RegExp(r'0x\S*?(?= )').firstMatch(error.toString());
181 + var errorRegex = RegExp(r'(?:0x\S*?|[0-9a-f]{4})(?= )').firstMatch(error.toString());
182
183 String errorCode = errorRegex?.group(0).toString().replaceAll("0x", "") ?? "";
184 if (errorCode.contains("6985")) {