Files
Birthday-Pool-Bot/birthday_pool_bot/repositories/exceptions.py
2026-01-15 09:47:43 +03:00

21 lines
478 B
Python

from typing import Any
from sqlmodel import SQLModel
class RepositoryException(Exception):
pass
class HaveNoSessionError(RepositoryException):
def __init__(self):
super().__init__("Have no actual session")
class AlreadyExistsError(RepositoryException):
def __init__(self, model: SQLModel, values: dict[str, Any]):
super().__init__(f"Record for model '{model.__name__}' already exists")
self.model = model
self.values = values