fix: handled value Error (#18361)

This commit is contained in:
Anurag Mishra 2019-07-18 12:43:18 +05:30 committed by Nabin Hait
parent 98a9a4865e
commit 0e23307dbf

View File

@ -48,7 +48,10 @@ class BankAccount(Document):
# Encode characters as numbers
encoded = [encode_char(c) if ord(c) >= 65 and ord(c) <= 90 else c for c in flipped]
to_check = int(''.join(encoded))
try:
to_check = int(''.join(encoded))
except ValueError:
frappe.throw(_('IBAN is not valid'))
if to_check % 97 != 1:
frappe.throw(_('IBAN is not valid'))