Skip to content
Snippets Groups Projects
Commit 00163e92 authored by inso's avatar inso
Browse files

Handle NotEnoughMoneyError

parent cd435424
No related branches found
No related tags found
No related merge requests found
...@@ -323,13 +323,15 @@ class Wallet(QObject): ...@@ -323,13 +323,15 @@ class Wallet(QObject):
} }
transfer = Transfer.initiate(metadata) transfer = Transfer.initiate(metadata)
self.caches[community.currency]._transfers.append(transfer) self.caches[community.currency]._transfers.append(transfer)
try:
tx = self.prepare_tx(recipient, amount, message, community) tx = self.prepare_tx(recipient, amount, message, community)
logging.debug("TX : {0}".format(tx.raw())) logging.debug("TX : {0}".format(tx.raw()))
tx.sign([key]) tx.sign([key])
logging.debug("Transaction : {0}".format(tx.signed_raw())) logging.debug("Transaction : {0}".format(tx.signed_raw()))
return await transfer.send(tx, community) return await transfer.send(tx, community)
except NotEnoughMoneyError as e:
return (False, str(e))
async def sources(self, community): async def sources(self, community):
""" """
......
...@@ -139,6 +139,7 @@ class TransferMoneyDialog(QObject): ...@@ -139,6 +139,7 @@ class TransferMoneyDialog(QObject):
return return
QApplication.setOverrideCursor(Qt.WaitCursor) QApplication.setOverrideCursor(Qt.WaitCursor)
result = await self.wallet.send_money(self.account.salt, password, self.community, result = await self.wallet.send_money(self.account.salt, password, self.community,
recipient, amount, comment) recipient, amount, comment)
if result[0]: if result[0]:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment