mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 20:46:02 +08:00
feat: add NotFound error for dataset service (#9215)
This commit is contained in:
parent
8bcad002df
commit
e0c8189f1a
@ -8,6 +8,7 @@ from typing import Optional
|
|||||||
|
|
||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
|
from werkzeug.exceptions import NotFound
|
||||||
|
|
||||||
from configs import dify_config
|
from configs import dify_config
|
||||||
from core.errors.error import LLMBadRequestError, ProviderTokenNotInitError
|
from core.errors.error import LLMBadRequestError, ProviderTokenNotInitError
|
||||||
@ -975,6 +976,8 @@ class DocumentService:
|
|||||||
):
|
):
|
||||||
DatasetService.check_dataset_model_setting(dataset)
|
DatasetService.check_dataset_model_setting(dataset)
|
||||||
document = DocumentService.get_document(dataset.id, document_data["original_document_id"])
|
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":
|
if document.display_status != "available":
|
||||||
raise ValueError("Document is not available")
|
raise ValueError("Document is not available")
|
||||||
# update document name
|
# update document name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user