- Updated import statements in the following files to import ResponseBase directly from models instead of models.response: - routers/api/v1/share/__init__.py - routers/api/v1/site/__init__.py - routers/api/v1/slave/__init__.py - routers/api/v1/tag/__init__.py - routers/api/v1/user/__init__.py - routers/api/v1/vas/__init__.py - routers/api/v1/webdav/__init__.py Enhance user registration and related endpoints in user router - Changed return type annotations from models.response.ResponseBase to models.ResponseBase in multiple functions. - Updated return statements to reflect the new import structure. - Improved documentation for clarity. Add PhysicalFile model and storage service implementation - Introduced PhysicalFile model to represent actual files on disk with reference counting logic. - Created storage service module with local storage implementation, including file operations and error handling. - Defined exceptions for storage operations to improve error handling. - Implemented naming rule parser for generating file and directory names based on templates. Update dependency management in uv.lock - Added aiofiles version 25.1.0 to the project dependencies.
46 lines
799 B
Python
46 lines
799 B
Python
"""
|
|
存储服务异常定义
|
|
|
|
定义存储操作相关的异常类型,用于精确的错误处理和诊断。
|
|
"""
|
|
|
|
|
|
class StorageException(Exception):
|
|
"""存储服务基础异常"""
|
|
pass
|
|
|
|
|
|
class DirectoryCreationError(StorageException):
|
|
"""目录创建失败"""
|
|
pass
|
|
|
|
|
|
class StorageFileNotFoundError(StorageException):
|
|
"""文件不存在"""
|
|
pass
|
|
|
|
|
|
class FileWriteError(StorageException):
|
|
"""文件写入失败"""
|
|
pass
|
|
|
|
|
|
class FileReadError(StorageException):
|
|
"""文件读取失败"""
|
|
pass
|
|
|
|
|
|
class UploadSessionNotFoundError(StorageException):
|
|
"""上传会话不存在"""
|
|
pass
|
|
|
|
|
|
class UploadSessionExpiredError(StorageException):
|
|
"""上传会话已过期"""
|
|
pass
|
|
|
|
|
|
class InvalidPathError(StorageException):
|
|
"""无效的路径"""
|
|
pass
|