refactor(api): TOML 配置 SSOT、统一错误契约、Auth/事务加固与可观测性 (#33)
配置 SSOT(TOML + .env) 统一错误契约 Auth 与事务边界 Redis / Celery 可靠性:业务 Redis(DB/0)与 Celery broker/backend(DB/1)显式拆分;连接池、sync client 可观测性(OpenTelemetry + LGTM)
This commit is contained in:
@@ -1,13 +1,21 @@
|
||||
"""评测 API 领域异常(由 router 映射为 HTTP 状态码)。"""
|
||||
"""评测 API 领域异常(继承 AppError,由全局 handler 统一映射)。"""
|
||||
|
||||
from app.core.errors import BadRequestError, NotFoundError
|
||||
|
||||
|
||||
class EvaluationNotFoundError(Exception):
|
||||
class EvaluationNotFoundError(NotFoundError):
|
||||
def __init__(self, detail: str = "not found") -> None:
|
||||
self.detail = detail
|
||||
super().__init__(detail)
|
||||
|
||||
@property
|
||||
def detail(self) -> str:
|
||||
return self.message
|
||||
|
||||
class EvaluationBadRequestError(Exception):
|
||||
|
||||
class EvaluationBadRequestError(BadRequestError):
|
||||
def __init__(self, detail: str) -> None:
|
||||
self.detail = detail
|
||||
super().__init__(detail)
|
||||
|
||||
@property
|
||||
def detail(self) -> str:
|
||||
return self.message
|
||||
|
||||
Reference in New Issue
Block a user