Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat: add NotFound error for dataset service (#9215)

crazywoolae0c8189f1ab6
diff --git a/api/services/dataset_service.py b/api/services/dataset_service.py
index b8f80a9f77e..4f77fdc18cb 100644
--- a/api/services/dataset_service.py
+++ b/api/services/dataset_service.py
@@ -8,6 +8,7 @@ from typing import Optional
from flask_login import current_user
from sqlalchemy import func
+from werkzeug.exceptions import NotFound
from configs import dify_config
from core.errors.error import LLMBadRequestError, ProviderTokenNotInitError
@@ -975,6 +976,8 @@ class DocumentService:
):
DatasetService.check_dataset_model_setting(dataset)
document = DocumentService.get_document(dataset.id, document_data["original_document_id"])
+ if document is None:
+ raise NotFound("Document not found")
if document.display_status != "available":
raise ValueError("Document is not available")
# update document name