Files
group_xinghuo_jinrong/app/advisor_exceptions.py
T
zhanghongyu_0626 70aa861983 feat(advisor-agent): Introduce advisor agent functionalities with compliance, KYC, and script templates
- Added new modules for advisor compliance, KYC sessions, and script templates, enhancing the advisor agent's capabilities.
- Implemented a comprehensive API structure under the `/api/advisor-agent` prefix, ensuring clear organization and access to new features.
- Established database models and repositories for compliance rules and KYC sessions, facilitating robust data management.
- Integrated exception handling and response models to improve error management and user feedback.
- Updated settings to include new configurations for compliance and KYC features, ensuring flexibility and adaptability.

This update significantly expands the advisor agent's functionality, providing essential tools for compliance and customer interaction while maintaining a structured API design.
2026-09-12 16:33:07 +08:00

28 lines
901 B
Python

"""投资顾问 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},
)