1
0

Catch wallet file related exceptions in Qt wizard.

This commit is contained in:
SomberNight
2018-03-17 22:56:20 +01:00
parent 680df7d6b6
commit 61a45edee0
7 changed files with 63 additions and 38 deletions

View File

@@ -44,7 +44,8 @@ from electrum import WalletStorage
# from electrum.synchronizer import Synchronizer
# from electrum.verifier import SPV
# from electrum.util import DebugMem
from electrum.util import UserCancelled, print_error
from electrum.util import (UserCancelled, print_error,
WalletFileException, BitcoinException)
# from electrum.wallet import Abstract_Wallet
from .installwizard import InstallWizard, GoBack
@@ -191,7 +192,7 @@ class ElectrumGui:
except BaseException as e:
traceback.print_exc(file=sys.stdout)
d = QMessageBox(QMessageBox.Warning, _('Error'),
_('Cannot load wallet:') + '\n' + str(e))
_('Cannot load wallet') + ' (1):\n' + str(e))
d.exec_()
return
if not wallet:
@@ -203,7 +204,14 @@ class ElectrumGui:
pass
except GoBack as e:
print_error('[start_new_window] Exception caught (GoBack)', e)
wizard.terminate()
except (WalletFileException, BitcoinException) as e:
traceback.print_exc(file=sys.stderr)
d = QMessageBox(QMessageBox.Warning, _('Error'),
_('Cannot load wallet') + ' (2):\n' + str(e))
d.exec_()
return
finally:
wizard.terminate()
if not wallet:
return
@@ -220,7 +228,7 @@ class ElectrumGui:
except BaseException as e:
traceback.print_exc(file=sys.stdout)
d = QMessageBox(QMessageBox.Warning, _('Error'),
_('Cannot create window for wallet:') + '\n' + str(e))
_('Cannot create window for wallet') + ':\n' + str(e))
d.exec_()
return
if uri: