""" KCSC MCP 애플리케이션의 사용자 정의 예외 클래스 """ class KCSCBaseException(Exception): """KCSC 관련 모든 예외의 기본 클래스""" def __init__(self, message, error_code=None): self.message = message self.error_code = error_code super().__init__(self.message) class APIError(KCSCBaseException): """API 통신 관련 오류""" def __init__(self, message, status_code=None, response=None): self.status_code = status_code self.response = response error_code = f"API-{status_code}" if status_code else "API-ERR" super().__init__(message, error_code) class ConfigError(KCSCBaseException): """설정 관련 오류""" def __init__(self, message): super().__init__(message, "CONFIG-ERR") class VectorDBError(KCSCBaseException): """벡터 데이터베이스 관련 오류""" def __init__(self, message, operation=None): self.operation = operation error_code = f"VECTDB-{operation}" if operation else "VECTDB-ERR" super().__init__(message, error_code) class MCPError(KCSCBaseException): """MCP 처리 관련 오류""" def __init__(self, message, operation=None): self.operation = operation error_code = f"MCP-{operation}" if operation else "MCP-ERR" super().__init__(message, error_code) class DataProcessingError(KCSCBaseException): """데이터 처리 관련 오류""" def __init__(self, message, data_type=None): self.data_type = data_type error_code = f"DATA-{data_type}" if data_type else "DATA-ERR" super().__init__(message, error_code) class AuthenticationError(KCSCBaseException): """인증 관련 오류""" def __init__(self, message): super().__init__(message, "AUTH-ERR")