From aa47a960a79106256359dc567aca222cc15f1148 Mon Sep 17 00:00:00 2001 From: f321x Date: Wed, 10 Dec 2025 16:48:17 +0100 Subject: [PATCH] ledger: throw UserFacingException for OSError Throws UserFacingException if the communication with the ledger fails due to an OSError. This happens e.g. if the Bitcoin app has been closed. We shouldn't get crash reports for errors due to disconnection. --- electrum/plugins/ledger/ledger.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/electrum/plugins/ledger/ledger.py b/electrum/plugins/ledger/ledger.py index 17f084853..f10f97f44 100644 --- a/electrum/plugins/ledger/ledger.py +++ b/electrum/plugins/ledger/ledger.py @@ -137,6 +137,11 @@ def test_pin_unlocked(func): return func(self, *args, **kwargs) except SecurityStatusNotSatisfiedError: raise UserFacingException(_('Your Ledger is locked. Please unlock it.')) + except OSError as e: + _logger.exception('') + raise UserFacingException( + _('Communication with Ledger failed. Open the Bitcoin app and try again.') + f'\n{str(e)}', + ) return catch_exception