Skip to content

Creating Robust Error Handlling #24

@Dralt03

Description

@Dralt03
    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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions