mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-14 21:52:56 +08:00
* 🐛 修复数据库超时问题 * 🔧 移除帮助图片清理功能. * ✨ 更新插件商店功能,允许在添加插件时指定源类型为 None。优化插件 ID 查找逻辑,增强代码可读性。新增 zhenxun/ui 模块导入。 * 🔧 优化数据访问和数据库上下文逻辑,移除不必要的全局变量和日志信息,调整日志级别为调试,提升代码可读性和性能。 * ✨ 增强插件商店功能,支持在下载文件时指定稀疏检出路径和目标目录。优化二进制文件处理逻辑,提升文件下载的准确性和效率。 * ✨ 增强阿里云和GitHub的文件管理功能,新增Git不可用异常处理,优化稀疏检出逻辑,提升代码可读性和稳定性。 * ✨ 增强插件下载功能,新增对下载结果的异常处理,确保在Git不可用时抛出相应异常信息。优化错误提示,提升用户体验。 * ✨ 增强插件商店功能,优化添加插件时的提示信息,明确区分插件模块和名称。新增 Windows 下删除只读文件的处理逻辑,提升插件管理的稳定性和用户体验。 * ✨ 优化文件内容获取逻辑,新增对非二进制文件的UTF-8解码处理,提升文件读取的稳定性和准确性。
76 lines
1.9 KiB
Python
76 lines
1.9 KiB
Python
"""
|
|
仓库管理工具的异常类
|
|
"""
|
|
|
|
|
|
class RepoManagerError(Exception):
|
|
"""仓库管理工具异常基类"""
|
|
|
|
def __init__(self, message: str, repo_name: str | None = None):
|
|
self.message = message
|
|
self.repo_name = repo_name
|
|
super().__init__(self.message)
|
|
|
|
|
|
class RepoUpdateError(RepoManagerError):
|
|
"""仓库更新异常"""
|
|
|
|
def __init__(self, message: str, repo_name: str | None = None):
|
|
super().__init__(f"仓库更新失败: {message}", repo_name)
|
|
|
|
|
|
class RepoDownloadError(RepoManagerError):
|
|
"""仓库下载异常"""
|
|
|
|
def __init__(self, message: str, repo_name: str | None = None):
|
|
super().__init__(f"文件下载失败: {message}", repo_name)
|
|
|
|
|
|
class RepoNotFoundError(RepoManagerError):
|
|
"""仓库不存在异常"""
|
|
|
|
def __init__(self, repo_name: str):
|
|
super().__init__(f"仓库不存在: {repo_name}", repo_name)
|
|
|
|
|
|
class FileNotFoundError(RepoManagerError):
|
|
"""文件不存在异常"""
|
|
|
|
def __init__(self, file_path: str, repo_name: str | None = None):
|
|
super().__init__(f"文件不存在: {file_path}", repo_name)
|
|
|
|
|
|
class AuthenticationError(RepoManagerError):
|
|
"""认证异常"""
|
|
|
|
def __init__(self, repo_type: str):
|
|
super().__init__(f"认证失败: {repo_type}")
|
|
|
|
|
|
class ApiRateLimitError(RepoManagerError):
|
|
"""API速率限制异常"""
|
|
|
|
def __init__(self, repo_type: str):
|
|
super().__init__(f"API速率限制: {repo_type}")
|
|
|
|
|
|
class NetworkError(RepoManagerError):
|
|
"""网络异常"""
|
|
|
|
def __init__(self, message: str):
|
|
super().__init__(f"网络错误: {message}")
|
|
|
|
|
|
class ConfigError(RepoManagerError):
|
|
"""配置异常"""
|
|
|
|
def __init__(self, message: str):
|
|
super().__init__(f"配置错误: {message}")
|
|
|
|
|
|
class GitUnavailableError(RepoManagerError):
|
|
"""Git不可用异常"""
|
|
|
|
def __init__(self, message: str = "Git命令不可用"):
|
|
super().__init__(message)
|