AgentEvalTool/backend/agenteval/exploration/errors.py
sinohqb df76edcf55
Some checks failed
CI / test (push) Failing after 33s
refactor(exploration): move ledger and state machine into domain modules
架构保养候选 3:探索生命周期的账本规则与状态机从 HTTP 层落入
exploration/lifecycle.py(open/conduct/close)与 patrol.py(巡检读模型),
违规改用类型化领域异常(NotFound/Guardrail/Channel),router 瘦回纯
HTTP 翻译(404/409/502 映射),领域层不再依赖 fastapi,可脱离
TestClient 直测(新增 12 个单元测试)。
2026-08-04 03:46:51 +08:00

27 lines
785 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Domain errors for exploratory evaluation (不依赖 fastapi).
领域违规用类型化异常表达router 统一映射 HTTP 状态码:
NotFound → 404Guardrail → 409reason 即给常驻代理的反馈),
Channel → 502。
"""
class ExplorationNotFoundError(Exception):
"""探索域实体(活动 / 评测对象 / 会话)不存在。"""
class ExplorationGuardrailError(Exception):
"""平台账本规则违规(状态机 / 预算),拒绝本身即反馈。"""
def __init__(self, reason: str):
self.reason = reason
super().__init__(reason)
class ExplorationChannelError(Exception):
"""评测对象通道收发失败。"""
def __init__(self, reason: str):
self.reason = reason
super().__init__(reason)