Javelina/classes/errors/wallet.py

27 lines
923 B
Python
Raw Normal View History

2025-02-18 08:04:02 +01:00
class WalletNotFoundError(Exception):
"""Wallet could not find user with such an ID from a guild in the database"""
def __init__(self, owner_id: int, guild_id: int) -> None:
self.owner_id = owner_id
self.guild_id = guild_id
super().__init__(
f"Wallet of a user with id {self.owner_id} was not found for the guild with id {self.guild_id}"
)
2025-02-18 20:25:57 +01:00
class WalletInsufficientFunds(Exception):
"""Wallet's balance is not sufficient to perform the operation"""
def __init__(
self,
wallet: "Wallet",
amount: float,
2025-02-18 20:25:57 +01:00
) -> None:
self.wallet = wallet
self.amount = amount
super().__init__(
f"Wallet of a user with id {self.wallet.owner_id} for the guild with id {self.wallet.guild_id} does not have sufficient funds to perform the operation (balance: {self.wallet.balance}, requested: {self.amount})"
)