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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: enhance file upload error handling and update base error class (#12132)
-LAN-be7877f5265b
diff --git a/api/controllers/service_api/dataset/document.py b/api/controllers/service_api/dataset/document.pyindex 84c58c62df5..ea664b8f1be 100644--- a/api/controllers/service_api/dataset/document.py+++ b/api/controllers/service_api/dataset/document.py@@ -8,12 +8,16 @@ from werkzeug.exceptions import NotFoundimport services.dataset_servicefrom controllers.common.errors import FilenameNotExistsErrorfrom controllers.service_api import api-from controllers.service_api.app.error import ProviderNotInitializeError+from controllers.service_api.app.error import (+ FileTooLargeError,+ NoFileUploadedError,+ ProviderNotInitializeError,+ TooManyFilesError,+ UnsupportedFileTypeError,+)from controllers.service_api.dataset.error import (ArchivedDocumentImmutableError,DocumentIndexingError,- NoFileUploadedError,- TooManyFilesError,)from controllers.service_api.wraps import DatasetApiResource, cloud_edition_billing_resource_checkfrom core.errors.error import ProviderTokenNotInitError@@ -238,13 +242,18 @@ class DocumentUpdateByFileApi(DatasetApiResource):if not file.filename:raise FilenameNotExistsError- upload_file = FileService.upload_file(- filename=file.filename,- content=file.read(),- mimetype=file.mimetype,- user=current_user,- source="datasets",- )+ try:+ upload_file = FileService.upload_file(+ filename=file.filename,+ content=file.read(),+ mimetype=file.mimetype,+ user=current_user,+ source="datasets",+ )+ except services.errors.file.FileTooLargeError as file_too_large_error:+ raise FileTooLargeError(file_too_large_error.description)+ except services.errors.file.UnsupportedFileTypeError:+ raise UnsupportedFileTypeError()data_source = {"type": "upload_file", "info_list": {"file_info_list": {"file_ids": [upload_file.id]}}}args["data_source"] = data_source# validate argsdiff --git a/api/services/errors/base.py b/api/services/errors/base.pyindex 4d39f956b8c..35ea28468e0 100644--- a/api/services/errors/base.py+++ b/api/services/errors/base.py@@ -1,6 +1,6 @@from typing import Optional-class BaseServiceError(Exception):+class BaseServiceError(ValueError):def __init__(self, description: Optional[str] = None):self.description = description