dify
This commit is contained in:
27
dify/api/services/errors/__init__.py
Normal file
27
dify/api/services/errors/__init__.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from . import (
|
||||
account,
|
||||
app,
|
||||
app_model_config,
|
||||
audio,
|
||||
base,
|
||||
conversation,
|
||||
dataset,
|
||||
document,
|
||||
file,
|
||||
index,
|
||||
message,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"account",
|
||||
"app",
|
||||
"app_model_config",
|
||||
"audio",
|
||||
"base",
|
||||
"conversation",
|
||||
"dataset",
|
||||
"document",
|
||||
"file",
|
||||
"index",
|
||||
"message",
|
||||
]
|
||||
57
dify/api/services/errors/account.py
Normal file
57
dify/api/services/errors/account.py
Normal file
@@ -0,0 +1,57 @@
|
||||
from services.errors.base import BaseServiceError
|
||||
|
||||
|
||||
class AccountNotFoundError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class AccountRegisterError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class AccountLoginError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class AccountPasswordError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class AccountNotLinkTenantError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class CurrentPasswordIncorrectError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class LinkAccountIntegrateError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class TenantNotFoundError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class AccountAlreadyInTenantError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class InvalidActionError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class CannotOperateSelfError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class NoPermissionError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class MemberNotInTenantError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class RoleAlreadyAssignedError(BaseServiceError):
|
||||
pass
|
||||
46
dify/api/services/errors/app.py
Normal file
46
dify/api/services/errors/app.py
Normal file
@@ -0,0 +1,46 @@
|
||||
class MoreLikeThisDisabledError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class WorkflowHashNotEqualError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class IsDraftWorkflowError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class WorkflowNotFoundError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class WorkflowIdFormatError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class InvokeRateLimitError(Exception):
|
||||
"""Raised when rate limit is exceeded for workflow invocations."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class QuotaExceededError(ValueError):
|
||||
"""Raised when billing quota is exceeded for a feature."""
|
||||
|
||||
def __init__(self, feature: str, tenant_id: str, required: int):
|
||||
self.feature = feature
|
||||
self.tenant_id = tenant_id
|
||||
self.required = required
|
||||
super().__init__(f"Quota exceeded for feature '{feature}' (tenant: {tenant_id}). Required: {required}")
|
||||
|
||||
|
||||
class TriggerNodeLimitExceededError(ValueError):
|
||||
"""Raised when trigger node count exceeds the plan limit."""
|
||||
|
||||
def __init__(self, count: int, limit: int):
|
||||
self.count = count
|
||||
self.limit = limit
|
||||
super().__init__(
|
||||
f"Trigger node count ({count}) exceeds the limit ({limit}) for your subscription plan. "
|
||||
f"Please upgrade your plan or reduce the number of trigger nodes."
|
||||
)
|
||||
9
dify/api/services/errors/app_model_config.py
Normal file
9
dify/api/services/errors/app_model_config.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from services.errors.base import BaseServiceError
|
||||
|
||||
|
||||
class AppModelConfigBrokenError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class ProviderNotFoundError(BaseServiceError):
|
||||
pass
|
||||
22
dify/api/services/errors/audio.py
Normal file
22
dify/api/services/errors/audio.py
Normal file
@@ -0,0 +1,22 @@
|
||||
class NoAudioUploadedServiceError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class AudioTooLargeServiceError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class UnsupportedAudioTypeServiceError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class ProviderNotSupportSpeechToTextServiceError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class ProviderNotSupportTextToSpeechServiceError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class ProviderNotSupportTextToSpeechLanageServiceError(Exception):
|
||||
pass
|
||||
3
dify/api/services/errors/base.py
Normal file
3
dify/api/services/errors/base.py
Normal file
@@ -0,0 +1,3 @@
|
||||
class BaseServiceError(ValueError):
|
||||
def __init__(self, description: str | None = None):
|
||||
self.description = description
|
||||
9
dify/api/services/errors/chunk.py
Normal file
9
dify/api/services/errors/chunk.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from services.errors.base import BaseServiceError
|
||||
|
||||
|
||||
class ChildChunkIndexingError(BaseServiceError):
|
||||
description = "{message}"
|
||||
|
||||
|
||||
class ChildChunkDeleteIndexError(BaseServiceError):
|
||||
description = "{message}"
|
||||
21
dify/api/services/errors/conversation.py
Normal file
21
dify/api/services/errors/conversation.py
Normal file
@@ -0,0 +1,21 @@
|
||||
from services.errors.base import BaseServiceError
|
||||
|
||||
|
||||
class LastConversationNotExistsError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class ConversationNotExistsError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class ConversationCompletedError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class ConversationVariableNotExistsError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class ConversationVariableTypeMismatchError(BaseServiceError):
|
||||
pass
|
||||
9
dify/api/services/errors/dataset.py
Normal file
9
dify/api/services/errors/dataset.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from services.errors.base import BaseServiceError
|
||||
|
||||
|
||||
class DatasetNameDuplicateError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class DatasetInUseError(BaseServiceError):
|
||||
pass
|
||||
5
dify/api/services/errors/document.py
Normal file
5
dify/api/services/errors/document.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from services.errors.base import BaseServiceError
|
||||
|
||||
|
||||
class DocumentIndexingError(BaseServiceError):
|
||||
pass
|
||||
17
dify/api/services/errors/file.py
Normal file
17
dify/api/services/errors/file.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from services.errors.base import BaseServiceError
|
||||
|
||||
|
||||
class FileNotExistsError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class FileTooLargeError(BaseServiceError):
|
||||
description = "{message}"
|
||||
|
||||
|
||||
class UnsupportedFileTypeError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class BlockedFileExtensionError(BaseServiceError):
|
||||
description = "File extension '{extension}' is not allowed for security reasons"
|
||||
5
dify/api/services/errors/index.py
Normal file
5
dify/api/services/errors/index.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from services.errors.base import BaseServiceError
|
||||
|
||||
|
||||
class IndexNotInitializedError(BaseServiceError):
|
||||
pass
|
||||
16
dify/api/services/errors/llm.py
Normal file
16
dify/api/services/errors/llm.py
Normal file
@@ -0,0 +1,16 @@
|
||||
class InvokeError(Exception):
|
||||
"""Base class for all LLM exceptions."""
|
||||
|
||||
description: str | None = None
|
||||
|
||||
def __init__(self, description: str | None = None):
|
||||
self.description = description
|
||||
|
||||
def __str__(self):
|
||||
return self.description or self.__class__.__name__
|
||||
|
||||
|
||||
class InvokeRateLimitError(InvokeError):
|
||||
"""Raised when the Invoke returns rate limit error."""
|
||||
|
||||
description = "Rate Limit Error"
|
||||
17
dify/api/services/errors/message.py
Normal file
17
dify/api/services/errors/message.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from services.errors.base import BaseServiceError
|
||||
|
||||
|
||||
class FirstMessageNotExistsError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class LastMessageNotExistsError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class MessageNotExistsError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class SuggestedQuestionsAfterAnswerDisabledError(BaseServiceError):
|
||||
pass
|
||||
5
dify/api/services/errors/plugin.py
Normal file
5
dify/api/services/errors/plugin.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from services.errors.base import BaseServiceError
|
||||
|
||||
|
||||
class PluginInstallationForbiddenError(BaseServiceError):
|
||||
pass
|
||||
10
dify/api/services/errors/workflow_service.py
Normal file
10
dify/api/services/errors/workflow_service.py
Normal file
@@ -0,0 +1,10 @@
|
||||
class WorkflowInUseError(ValueError):
|
||||
"""Raised when attempting to delete a workflow that's in use by an app"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class DraftWorkflowDeletionError(ValueError):
|
||||
"""Raised when attempting to delete a draft workflow"""
|
||||
|
||||
pass
|
||||
13
dify/api/services/errors/workspace.py
Normal file
13
dify/api/services/errors/workspace.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from services.errors.base import BaseServiceError
|
||||
|
||||
|
||||
class WorkSpaceNotAllowedCreateError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class WorkSpaceNotFoundError(BaseServiceError):
|
||||
pass
|
||||
|
||||
|
||||
class WorkspacesLimitExceededError(BaseServiceError):
|
||||
pass
|
||||
Reference in New Issue
Block a user