From 32dee14fd0863c8da148b0c737896fb71365d753 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 25 Aug 2017 09:27:40 +0200 Subject: [PATCH] show error message when parsing empty tx --- gui/qt/main_window.py | 5 ++--- lib/transaction.py | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index 3282fef4..35e88385 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -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): diff --git a/lib/transaction.py b/lib/transaction.py index 0e4b6e0c..16d701f4 100644 --- a/lib/transaction.py +++ b/lib/transaction.py @@ -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