# =============================================================================
# RAGFlow API 异常定义
# =============================================================================


class RagflowError(Exception):
    """RAGFlow 基础异常。"""
    def __init__(self, message: str = "RAGFlow 错误"):
        self.message = message
        super().__init__(self.message)


class RagflowConfigError(RagflowError):
    """配置错误（缺少 API Key 或 Base URL）。"""
    def __init__(self, message: str = "RAGFlow 配置缺失"):
        super().__init__(message)


class RagflowAuthError(RagflowError):
    """认证失败（API Key 无效）。"""
    def __init__(self, message: str = "RAGFlow 认证失败"):
        super().__init__(message)


class RagflowApiError(RagflowError):
    """API 调用失败（非 200 响应）。"""
    def __init__(self, code: int = 0, message: str = "RAGFlow API 错误"):
        self.code = code
        super().__init__(message)


class RagflowConnectionError(RagflowError):
    """网络连接失败。"""
    def __init__(self, message: str = "RAGFlow 连接失败"):
        super().__init__(message)
