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.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user