electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit a97cb88a1ab023967186ee9ade01d2c6f1b47d52
parent 13dca30428bf871c6683d826883d75d7945bc92d
Author: SomberNight <somber.night@protonmail.com>
Date:   Thu, 25 Jun 2020 23:48:24 +0200

qt sweep: raise more specific exception so that trace is not logged

When raising generic Exception, window.on_error can't tell whether
there was a programming error or we just want to communicate with the user.

E | gui.qt.main_window.[default_wallet] | on_error
Traceback (most recent call last):
  File "/home/user/wspace/electrum/electrum/gui/qt/util.py", line 832, in run
    result = task.task()
  File "/home/user/wspace/electrum/electrum/gui/qt/main_window.py", line 2900, in <lambda>
    task = lambda: self.network.run_from_another_thread(
  File "/home/user/wspace/electrum/electrum/network.py", line 358, in run_from_another_thread
    return fut.result(timeout)
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
  File "/home/user/wspace/electrum/electrum/wallet.py", line 162, in sweep_preparations
    raise Exception(_('No inputs found.'))
Exception: No inputs found.

Diffstat:
Melectrum/wallet.py | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/electrum/wallet.py b/electrum/wallet.py @@ -78,7 +78,7 @@ from .mnemonic import Mnemonic from .logging import get_logger from .lnworker import LNWallet, LNBackups from .paymentrequest import PaymentRequest -from .util import read_json_file, write_json_file +from .util import read_json_file, write_json_file, UserFacingException if TYPE_CHECKING: from .network import Network @@ -159,7 +159,7 @@ async def sweep_preparations(privkeys, network: 'Network', imax=100): # we also search for pay-to-pubkey outputs await group.spawn(find_utxos_for_privkey('p2pk', privkey, compressed)) if not inputs: - raise Exception(_('No inputs found.')) + raise UserFacingException(_('No inputs found.')) return inputs, keypairs