Files
disknext/service/storage/exceptions.py
于小丘 3639a31163
Some checks failed
Test / test (push) Failing after 2m21s
feat: add S3 storage support, policy migration, and quota enforcement
- Add S3StorageService with AWS Signature V4 signing (URI-encoded for non-ASCII keys)
- Add PATCH /object/{id}/policy endpoint for switching storage policies with background migration
- Implement cross-storage file migration service (local <-> S3)
- Replace deprecated StorageType enum with PolicyType (local/s3)
- Implement GET /user/settings/policies endpoint (was 501 stub)
- Add storage quota pre-allocation on upload session creation to prevent concurrent bypass
- Fix BigInteger for max_storage and user.storage to support >2GB values
- Add policy permission validation on upload and directory creation
- Use group's first policy as default on registration instead of hardcoded name
- Define TaskType.POLICY_MIGRATE and extend TaskProps with migration fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 13:38:20 +08:00

56 lines
961 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
class S3APIError(StorageException):
"""S3 API 请求错误"""
pass
class S3MultipartUploadError(S3APIError):
"""S3 分片上传错误"""
pass