"""投资顾问 Agent 业务异常(与源分支 AppError 形一致,避免与宿主 AppError 签名冲突)。""" from __future__ import annotations class AdvisorAppError(Exception): def __init__(self, code: str, message: str, status_code: int = 400, data: dict | None = None) -> None: self.code = code self.message = message self.status_code = status_code self.data = data super().__init__(message) class OwnershipDeniedError(AdvisorAppError): def __init__(self, message: str = "Customer ownership denied") -> None: super().__init__("40302", message, 403) class GuardBlockedError(AdvisorAppError): def __init__(self, guard_type: str, reason: str) -> None: super().__init__( "40002", reason, 400, {"action": "blocked", "guard_type": guard_type, "reason": reason}, )