tshow error message when parsing empty tx - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit 32dee14fd0863c8da148b0c737896fb71365d753
DIR parent 01736197f85593b0616093608f630c052fd53779
HTML Author: ThomasV <thomasv@electrum.org>
Date: Fri, 25 Aug 2017 09:27:40 +0200
show error message when parsing empty tx
Diffstat:
M gui/qt/main_window.py | 5 ++---
M lib/transaction.py | 2 ++
2 files changed, 4 insertions(+), 3 deletions(-)
---
DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
t@@ -2018,9 +2018,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
try:
tx = tx_from_str(txt)
return Transaction(tx)
- except:
- traceback.print_exc(file=sys.stdout)
- self.show_critical(_("Electrum was unable to parse your transaction"))
+ except BaseException as e:
+ self.show_critical(_("Electrum was unable to parse your transaction") + ":\n" + str(e))
return
def read_tx_from_qrcode(self):
DIR diff --git a/lib/transaction.py b/lib/transaction.py
t@@ -896,6 +896,8 @@ def tx_from_str(txt):
"json or raw hexadecimal"
import json
txt = txt.strip()
+ if not txt:
+ raise ValueError("empty string")
try:
bfh(txt)
is_hex = True