Init project
This commit is contained in:
20
birthday_pool_bot/repositories/exceptions.py
Normal file
20
birthday_pool_bot/repositories/exceptions.py
Normal file
@@ -0,0 +1,20 @@
|
||||
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
|
||||
Reference in New Issue
Block a user