kcsc-mcp / src /utils /exceptions.py
nicefree19's picture
Upload 105 files
0ee3c92 verified
Raw
History Blame Contribute Delete
1.85 kB
"""
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")