From 40389a21b6c87046175f792b93782e5cccbddb19 Mon Sep 17 00:00:00 2001 From: JeremyRand Date: Wed, 8 Apr 2020 03:09:08 +0000 Subject: [PATCH] Use specific Exception when chain isn't synced Makes it easier for calling code to know what error happened. --- electrum/commands.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/electrum/commands.py b/electrum/commands.py index 2cf1ab00d..02fb82b38 100644 --- a/electrum/commands.py +++ b/electrum/commands.py @@ -68,6 +68,10 @@ if TYPE_CHECKING: known_commands = {} # type: Dict[str, Command] +class NotSynchronizedException(Exception): + pass + + def satoshis(amount): # satoshi conversion must not be performed by the parser return int(COIN*Decimal(amount)) if amount not in ['!', None] else amount @@ -815,7 +819,7 @@ class Commands: if not isinstance(wallet, Deterministic_Wallet): raise Exception("This wallet is not deterministic.") if not wallet.is_up_to_date(): - raise Exception("Wallet not fully synchronized.") + raise NotSynchronizedException("Wallet not fully synchronized.") return wallet.min_acceptable_gap() @command('w')