1
0

Merge branch 'error_handling' of DigiFi/digifi-BankToProductCore into master

This commit is contained in:
2025-11-11 22:02:23 +00:00
committed by Gogs
+3 -3
View File
@@ -47,11 +47,11 @@ class Customer(db.Model):
@classmethod
def create_customer(cls, id, msisdn, country_code, account_id, account_type='savings'):
if cls.query.filter_by(id=id).first():
raise ValueError("Customer already exists")
raise ValueError("Customer ID '{id}' already exists.")
elif Account.query.filter_by(id=account_id).first():
raise ValueError("Account already exists")
raise ValueError(f"Account ID '{account_id}' already exists.")
elif cls.query.filter_by(msisdn=msisdn).first():
raise ValueError("msisdn already exists")
raise ValueError("MSISDN '{msisdn}' already exists")
# Create the customer
customer = cls(