2024-11-01 15:51:22 +08:00
|
|
|
from werkzeug.exceptions import HTTPException
|
|
|
|
|
|
2025-08-13 17:06:07 +08:00
|
|
|
from libs.exception import BaseHTTPException
|
|
|
|
|
|
2024-11-01 15:51:22 +08:00
|
|
|
|
|
|
|
|
class FilenameNotExistsError(HTTPException):
|
|
|
|
|
code = 400
|
|
|
|
|
description = "The specified filename does not exist."
|
2024-12-21 21:22:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class RemoteFileUploadError(HTTPException):
|
|
|
|
|
code = 400
|
|
|
|
|
description = "Error uploading remote file."
|
2025-08-13 17:06:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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 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
|