This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# app/exceptions/__init__.py
|
||||
"""
|
||||
HealthSync AI 예외 패키지
|
||||
"""
|
||||
from .custom_exceptions import (
|
||||
HealthSyncException,
|
||||
UserNotFoundException,
|
||||
HealthDataNotFoundException,
|
||||
DatabaseException,
|
||||
ClaudeAPIException
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"HealthSyncException",
|
||||
"UserNotFoundException",
|
||||
"HealthDataNotFoundException",
|
||||
"DatabaseException",
|
||||
"ClaudeAPIException"
|
||||
]
|
||||
@@ -0,0 +1,42 @@
|
||||
# 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")
|
||||
Reference in New Issue
Block a user