"""
MCP 캘린더 시스템의 예외 처리
"""
from typing import Optional
class CalendarException(Exception):
"""캘린더 관련 기본 예외"""
def __init__(self, message: str, cause: Optional[Exception] = None):
super().__init__(message)
self.cause = cause
class EventNotFound(CalendarException):
"""이벤트를 찾을 수 없는 경우"""
def __init__(self, event_id: int):
super().__init__(f"Event not found: {event_id}")
self.event_id = event_id
class InvalidEventData(CalendarException):
"""잘못된 이벤트 데이터"""
def __init__(self, field: str, value: str):
super().__init__(f"Invalid {field}: {value}")
self.field = field
self.value = value
class McpClientError(CalendarException):
"""MCP 클라이언트 오류"""
def __init__(self, message: str, cause: Optional[Exception] = None):
super().__init__(f"MCP client error: {message}")
self.cause = cause
class UnauthorizedAccess(CalendarException):
"""권한 없는 접근"""
def __init__(self, user_id: int, event_id: int):
super().__init__(f"User {user_id} cannot access event {event_id}")
self.user_id = user_id
self.event_id = event_id