try:
with self._account_lock:
from_account = self.get_account(from_account_id)
to_account = self.get_account(to_account_id)
if not from_account or not to_account:
print("Invalid account(s)")
return False
if from_account.withdraw(amount):
to_account.deposit(amount)
return True
return False
except Exception as e:
print(f"Transfer failed: {e}")
return False
Even though the current implementation of the error handling works these are not sufficient. Errors show be logged more clearly.
Even though the current implementation of the error handling works these are not sufficient. Errors show be logged more clearly.