-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexceptions.py
More file actions
24 lines (18 loc) · 829 Bytes
/
Copy pathexceptions.py
File metadata and controls
24 lines (18 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class AccountNotFound(Exception):
def __init__(self, account_id: int):
self.account_id = account_id
super().__init__(f"Account {account_id} not found.")
class TransactionNotFound(Exception):
def __init__(self, transaction_id: int):
self.transaction_id = transaction_id
super().__init__(f"Transaction {transaction_id} not found.")
class InsufficientFunds(Exception):
def __init__(self, account_id: int):
self.account_id = account_id
super().__init__(f"Account {account_id} has insufficient funds.")
class IdempotencyKeyConflict(Exception):
def __init__(self, idempotency_key: str):
self.idempotency_key = idempotency_key
super().__init__(
f"Idempotency key '{idempotency_key}' was already used with different parameters."
)