79 lines
1.8 KiB
Python
79 lines
1.8 KiB
Python
from uuid import UUID
|
|
|
|
|
|
class DomainError(Exception):
|
|
pass
|
|
|
|
|
|
class UserError(DomainError):
|
|
pass
|
|
|
|
|
|
class UserNotFoundError(UserError):
|
|
def __init__(self, user_id: str) -> None:
|
|
super().__init__('user_not_found')
|
|
self.user_id = user_id
|
|
|
|
|
|
class UserConflictError(UserError):
|
|
def __init__(self, email: str) -> None:
|
|
super().__init__('user_conflict')
|
|
self.email = email
|
|
|
|
|
|
class WorkspaceError(DomainError):
|
|
pass
|
|
|
|
|
|
class WorkspaceNotFoundError(WorkspaceError):
|
|
def __init__(self, workspace_id: UUID) -> None:
|
|
super().__init__('workspace_not_found')
|
|
self.workspace_id = workspace_id
|
|
|
|
|
|
class WorkspaceQuotaExceededError(WorkspaceError):
|
|
def __init__(self, workspace_id: UUID) -> None:
|
|
super().__init__('workspace_quota_exceeded')
|
|
self.workspace_id = workspace_id
|
|
|
|
|
|
class ChatError(DomainError):
|
|
pass
|
|
|
|
|
|
class ChatNotFoundError(ChatError):
|
|
def __init__(self, chat_id: UUID) -> None:
|
|
super().__init__('chat_not_found')
|
|
self.chat_id = chat_id
|
|
|
|
|
|
class ChatHasActiveSandboxError(ChatError):
|
|
def __init__(self, chat_id: UUID) -> None:
|
|
super().__init__('chat_has_active_sandbox')
|
|
self.chat_id = chat_id
|
|
|
|
|
|
class ChatFileError(DomainError):
|
|
pass
|
|
|
|
|
|
class ChatFileNotFoundError(ChatFileError):
|
|
def __init__(self, file_id: UUID) -> None:
|
|
super().__init__('chat_file_not_found')
|
|
self.file_id = file_id
|
|
|
|
|
|
class SandboxError(DomainError):
|
|
pass
|
|
|
|
|
|
class SandboxStartError(SandboxError):
|
|
def __init__(self, chat_id: str) -> None:
|
|
super().__init__('sandbox_start_failed')
|
|
self.chat_id = chat_id
|
|
|
|
|
|
class SandboxAlreadyRunningError(SandboxError):
|
|
def __init__(self, chat_id: str) -> None:
|
|
super().__init__('sandbox_already_running')
|
|
self.chat_id = chat_id
|