HealthSync_Intelligence/app/exceptions/custom_exceptions.py
hyerimmy 910bd902b1
Some checks failed
HealthSync Intelligence CI / build-and-push (push) Has been cancelled
feat : initial commit
2025-06-20 05:28:30 +00:00

42 lines
1.6 KiB
Python

# app/exceptions/custom_exceptions.py
"""
HealthSync AI 사용자 정의 예외 클래스
"""
class HealthSyncException(Exception):
"""HealthSync AI 기본 예외 클래스"""
def __init__(self, message: str, error_code: str = None):
self.message = message
self.error_code = error_code
super().__init__(self.message)
class UserNotFoundException(HealthSyncException):
"""사용자를 찾을 수 없는 경우"""
def __init__(self, user_id: int):
super().__init__(f"사용자 ID {user_id}를 찾을 수 없습니다.", "USER_NOT_FOUND")
class HealthDataNotFoundException(HealthSyncException):
"""건강검진 데이터를 찾을 수 없는 경우"""
def __init__(self, user_id: int):
super().__init__(f"사용자 ID {user_id}님의 건강검진 데이터를 찾을 수 없습니다. 건강검진 데이터를 먼저 등록해 주세요.", "HEALTH_DATA_NOT_FOUND")
class DatabaseException(HealthSyncException):
"""데이터베이스 관련 예외"""
def __init__(self, message: str):
super().__init__(f"데이터베이스 오류: {message}", "DATABASE_ERROR")
class ClaudeAPIException(HealthSyncException):
"""Claude API 관련 예외"""
def __init__(self, message: str):
super().__init__(f"Claude AI 서비스 오류: {message}", "CLAUDE_API_ERROR")
class MissionNotFoundException(HealthSyncException):
"""미션을 찾을 수 없는 경우"""
def __init__(self, mission_id: int):
super().__init__(f"미션 ID {mission_id}를 찾을 수 없습니다.", "MISSION_NOT_FOUND")