fix(bioflow): check_disk_available 捕获 OSError 返回 PATH_NOT_EXIST,不再抛未捕获异常 (#004)
This commit is contained in:
@@ -130,7 +130,10 @@ def check_download_budget(size_bytes: int, budget_bytes: int) -> dict[str, Any]:
|
||||
|
||||
def check_disk_available(dest_dir: str | Path, needed_bytes: int) -> dict[str, Any]:
|
||||
"""G23:磁盘门禁——剩余空间不足阻断并返回结构化错误。"""
|
||||
ok, free = check_disk_space(dest_dir, needed_bytes)
|
||||
try:
|
||||
ok, free = check_disk_space(dest_dir, needed_bytes)
|
||||
except OSError as exc:
|
||||
return error_result("PATH_NOT_EXIST", f"目标目录不可用:{exc}")
|
||||
if not ok:
|
||||
return error_result(
|
||||
"DISK_FULL", f"磁盘空间不足:需 {needed_bytes} 字节,剩余 {free} 字节",
|
||||
|
||||
Reference in New Issue
Block a user