mirror of
https://github.com/langgenius/dify.git
synced 2026-11-24 20:59:04 +08:00
28 lines
775 B
Python
28 lines
775 B
Python
from collections.abc import Iterable
|
|
|
|
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"
|
|
|
|
|
|
class UploadFileReferenceNotFoundError(ValueError):
|
|
"""Raised when a tenant does not own every file an owner will reference."""
|
|
|
|
def __init__(self, missing_file_ids: Iterable[str]) -> None:
|
|
self.missing_file_ids = tuple(sorted(set(missing_file_ids)))
|
|
super().__init__(f"Upload files no longer exist: {list(self.missing_file_ids)}")
|