mirror of
https://github.com/langgenius/dify.git
synced 2026-06-11 02:31:13 +08:00
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: 非法操作 <hjlarry@163.com> Co-authored-by: -LAN- <laipz8200@outlook.com>
54 lines
1.2 KiB
Python
54 lines
1.2 KiB
Python
from werkzeug.exceptions import HTTPException
|
|
|
|
from libs.exception import BaseHTTPException
|
|
|
|
|
|
class FilenameNotExistsError(HTTPException):
|
|
code = 400
|
|
description = "The specified filename does not exist."
|
|
|
|
|
|
class RemoteFileUploadError(HTTPException):
|
|
code = 400
|
|
description = "Error uploading remote file."
|
|
|
|
|
|
class FileTooLargeError(BaseHTTPException):
|
|
error_code = "file_too_large"
|
|
description = "File size exceeded. {message}"
|
|
code = 413
|
|
|
|
|
|
class UnsupportedFileTypeError(BaseHTTPException):
|
|
error_code = "unsupported_file_type"
|
|
description = "File type not allowed."
|
|
code = 415
|
|
|
|
|
|
class BlockedFileExtensionError(BaseHTTPException):
|
|
error_code = "file_extension_blocked"
|
|
description = "The file extension is blocked for security reasons."
|
|
code = 400
|
|
|
|
|
|
class TooManyFilesError(BaseHTTPException):
|
|
error_code = "too_many_files"
|
|
description = "Only one file is allowed."
|
|
code = 400
|
|
|
|
|
|
class NoFileUploadedError(BaseHTTPException):
|
|
error_code = "no_file_uploaded"
|
|
description = "Please upload your file."
|
|
code = 400
|
|
|
|
|
|
class NotFoundError(BaseHTTPException):
|
|
error_code = "not_found"
|
|
code = 404
|
|
|
|
|
|
class InvalidArgumentError(BaseHTTPException):
|
|
error_code = "invalid_param"
|
|
code = 400
|