Files

101 lines
3.1 KiB
Python
Raw Permalink Normal View History

2023-05-15 08:51:32 +08:00
from libs.exception import BaseHTTPException
from services.knowledge_fs.product_dto import (
KnowledgeFSUpgradeModelErrorDetailsResponse,
KnowledgeFSUpgradeModelIssueResponse,
)
2023-05-15 08:51:32 +08:00
class DatasetNotInitializedError(BaseHTTPException):
error_code = "dataset_not_initialized"
2023-05-22 17:39:28 +08:00
description = "The dataset is still being initialized or indexing. Please wait a moment."
2023-05-15 08:51:32 +08:00
code = 400
class KnowledgeFSUpgradeModelsUnavailableHTTPError(BaseHTTPException):
error_code = "knowledge_fs_upgrade_models_unavailable"
description = "One or more selected upgrade models are unavailable."
code = 422
details_model = KnowledgeFSUpgradeModelErrorDetailsResponse
def __init__(self, issues: list[KnowledgeFSUpgradeModelIssueResponse]) -> None:
super().__init__()
assert self.data is not None
self.data["details"] = KnowledgeFSUpgradeModelErrorDetailsResponse(issues=issues).model_dump(mode="json")
2023-05-15 08:51:32 +08:00
class ArchivedDocumentImmutableError(BaseHTTPException):
error_code = "archived_document_immutable"
2023-05-22 17:39:28 +08:00
description = "The archived document is not editable."
2023-05-15 08:51:32 +08:00
code = 403
class DatasetNameDuplicateError(BaseHTTPException):
error_code = "dataset_name_duplicate"
2023-05-22 17:39:28 +08:00
description = "The dataset name already exists. Please modify your dataset name."
2023-05-15 08:51:32 +08:00
code = 409
class DatasetConcurrentUpdateError(BaseHTTPException):
error_code = "dataset_concurrent_update"
description = "The dataset changed while it was being updated. Please retry the request."
code = 409
2023-05-15 08:51:32 +08:00
class InvalidActionError(BaseHTTPException):
error_code = "invalid_action"
2023-05-15 08:51:32 +08:00
description = "Invalid action."
code = 400
class DatasetAccessDeniedRequestError(BaseHTTPException):
error_code = "dataset_access_denied"
description = "Dataset access denied."
code = 403
2023-05-15 08:51:32 +08:00
class DocumentAlreadyFinishedError(BaseHTTPException):
error_code = "document_already_finished"
2023-05-22 17:39:28 +08:00
description = "The document has been processed. Please refresh the page or go to the document details."
2023-05-15 08:51:32 +08:00
code = 400
class DocumentIndexingError(BaseHTTPException):
error_code = "document_indexing"
2023-05-22 17:39:28 +08:00
description = "The document is being processed and cannot be edited."
2023-05-15 08:51:32 +08:00
code = 400
class InvalidMetadataError(BaseHTTPException):
error_code = "invalid_metadata"
2023-05-22 17:39:28 +08:00
description = "The metadata content is incorrect. Please check and verify."
2023-05-15 08:51:32 +08:00
code = 400
2024-06-15 02:46:02 +08:00
class WebsiteCrawlError(BaseHTTPException):
error_code = "crawl_failed"
2024-06-15 02:46:02 +08:00
description = "{message}"
code = 500
2024-06-26 12:51:50 +08:00
class IndexingEstimateError(BaseHTTPException):
error_code = "indexing_estimate_error"
2024-06-26 12:51:50 +08:00
description = "Knowledge indexing estimate failed: {message}"
code = 500
2024-12-25 19:49:07 +08:00
class ChildChunkIndexingError(BaseHTTPException):
error_code = "child_chunk_indexing_error"
description = "Create child chunk index failed: {message}"
code = 500
class ChildChunkDeleteIndexError(BaseHTTPException):
error_code = "child_chunk_delete_index_error"
description = "Delete child chunk index failed: {message}"
code = 500
+9
2025-09-18 12:49:10 +08:00
class PipelineNotFoundError(BaseHTTPException):
error_code = "pipeline_not_found"
description = "Pipeline not found."
code = 404