mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 10:15:20 +00:00
separate get_errors instead of raising an exception
This commit is contained in:
parent
b82e84907e
commit
300125422d
2 changed files with 9 additions and 15 deletions
|
@ -941,7 +941,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
|
|
||||||
amount = self.amount_e.get_amount()
|
amount = self.amount_e.get_amount()
|
||||||
fee = self.fee_e.get_amount()
|
fee = self.fee_e.get_amount()
|
||||||
outputs = self.payto_e.get_outputs(False)
|
outputs = self.payto_e.get_outputs()
|
||||||
|
|
||||||
if not is_fee:
|
if not is_fee:
|
||||||
fee = None
|
fee = None
|
||||||
|
@ -1034,12 +1034,11 @@ class ElectrumWindow(QMainWindow):
|
||||||
if self.payment_request:
|
if self.payment_request:
|
||||||
outputs = self.payment_request.get_outputs()
|
outputs = self.payment_request.get_outputs()
|
||||||
else:
|
else:
|
||||||
try:
|
errors = self.payto_e.get_errors()
|
||||||
outputs = self.payto_e.get_outputs()
|
if errors:
|
||||||
except ValueError as e:
|
self.show_warning(_("Invalid Lines found:") + "\n\n" + '\n'.join([ _("Line #") + str(x[0]+1) + ": " + x[1] for x in errors]))
|
||||||
traceback.print_exc(file=sys.stdout)
|
|
||||||
self.show_message(str(e))
|
|
||||||
return
|
return
|
||||||
|
outputs = self.payto_e.get_outputs()
|
||||||
|
|
||||||
if not outputs:
|
if not outputs:
|
||||||
QMessageBox.warning(self, _('Error'), _('No outputs'), _('OK'))
|
QMessageBox.warning(self, _('Error'), _('No outputs'), _('OK'))
|
||||||
|
|
|
@ -23,7 +23,6 @@ from qrtextedit import QRTextEdit
|
||||||
import re
|
import re
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from electrum import bitcoin
|
from electrum import bitcoin
|
||||||
from electrum.i18n import _
|
|
||||||
|
|
||||||
RE_ADDRESS = '[1-9A-HJ-NP-Za-km-z]{26,}'
|
RE_ADDRESS = '[1-9A-HJ-NP-Za-km-z]{26,}'
|
||||||
RE_ALIAS = '(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>'
|
RE_ALIAS = '(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>'
|
||||||
|
@ -143,21 +142,17 @@ class PayToEdit(QRTextEdit):
|
||||||
self.unlock_amount()
|
self.unlock_amount()
|
||||||
|
|
||||||
|
|
||||||
def get_outputs(self, show_err=True):
|
def get_errors(self):
|
||||||
|
return self.errors
|
||||||
|
|
||||||
|
def get_outputs(self):
|
||||||
if self.payto_address:
|
if self.payto_address:
|
||||||
try:
|
try:
|
||||||
amount = self.amount_edit.get_amount()
|
amount = self.amount_edit.get_amount()
|
||||||
except:
|
except:
|
||||||
amount = None
|
amount = None
|
||||||
|
|
||||||
self.outputs = [('address', self.payto_address, amount)]
|
self.outputs = [('address', self.payto_address, amount)]
|
||||||
|
|
||||||
if self.errors != [] and show_err:
|
|
||||||
errtext = ""
|
|
||||||
for x in self.errors:
|
|
||||||
errtext += _("Line #") + str(x[0]+1) + ": " + x[1] + "\n"
|
|
||||||
raise ValueError(_("ABORTING! Invalid Lines found:") + "\n\n" + errtext)
|
|
||||||
|
|
||||||
return self.outputs[:]
|
return self.outputs[:]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue