mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
✨ 增强插件下载功能,新增对下载结果的异常处理,确保在Git不可用时抛出相应异常信息。优化错误提示,提升用户体验。
This commit is contained in:
parent
b5417d1141
commit
fe5e6101e7
@ -279,13 +279,15 @@ class StoreManager:
|
||||
target_dir = BASE_PATH / "plugins" / plugin_name
|
||||
files = [file for file in files if not file.is_dir]
|
||||
download_files = [(file.path, local_path / file.path) for file in files]
|
||||
await RepoFileManager.download_files(
|
||||
result = await RepoFileManager.download_files(
|
||||
github_url,
|
||||
download_files,
|
||||
repo_type=repo_type,
|
||||
sparse_path=replace_module_path,
|
||||
target_dir=target_dir,
|
||||
)
|
||||
if not result.success:
|
||||
raise PluginStoreException(result.error_message)
|
||||
|
||||
requirement_paths = [
|
||||
file
|
||||
|
||||
@ -72,4 +72,4 @@ class GitUnavailableError(RepoManagerError):
|
||||
"""Git不可用异常"""
|
||||
|
||||
def __init__(self, message: str = "Git命令不可用"):
|
||||
super().__init__(f"Git不可用: {message}")
|
||||
super().__init__(message)
|
||||
|
||||
@ -621,7 +621,10 @@ class RepoFileManager:
|
||||
except GitUnavailableError as e:
|
||||
logger.error(f"Git不可用: {e}")
|
||||
result.success = False
|
||||
result.error_message = "Git不可用,请尝试添加参数 -s git"
|
||||
result.error_message = (
|
||||
"当前插件包含二进制文件,因ali限制需要使用git,"
|
||||
"当前Git不可用,请尝试添加参数 -s git 或 安装 git"
|
||||
)
|
||||
return result
|
||||
except Exception as e:
|
||||
logger.error(f"sparse-checkout 克隆失败: {e}")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user