feat: добавить каркас приложения с PostgreSQL, сессиями и Redis-кэшем

This commit is contained in:
Evgeny Bushkov
2026-11-06 00:22:27 +03:00
committed by Evgeny Bushkov (aider)
parent 0ab3a341aa
commit d8ba046033
6 changed files with 237 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
"""Единый формат ошибок API и исключение ApiError."""
from typing import Any
class ApiError(Exception):
"""Ошибка, которую нужно вернуть клиенту в формате контракта."""
def __init__(self, status: int, code: str, message: str) -> None:
super().__init__(message)
self.status = status
self.code = code
self.message = message
def error_body(code: str, message: str, request_id: str) -> dict[str, Any]:
return {"error": {"code": code, "message": message, "request_id": request_id}}