MCPcopy Create free account
hub / github.com/TheSmallHanCat/flow2api / _normalize_cache_error

Method _normalize_cache_error

src/services/file_cache.py:264–277  ·  view source on GitHub ↗

整理缓存错误,避免将底层命令异常直接暴露给用户。

(self, error: Exception)

Source from the content-addressed store, hash-verified

262 return f"{url_hash}{ext}"
263
264 def _normalize_cache_error(self, error: Exception) -> str:
265 """整理缓存错误,避免将底层命令异常直接暴露给用户。"""
266 if isinstance(error, FileNotFoundError):
267 missing_name = Path(getattr(error, "filename", "") or "curl").name or "curl"
268 return f"本机未安装 {missing_name}"
269
270 message = str(error or "").strip()
271 if not message:
272 return "未知错误"
273
274 if message.startswith("Failed to cache file:"):
275 message = message.split(":", 1)[1].strip() or "未知错误"
276
277 return message
278
279 async def download_and_cache(self, url: str, media_type: str) -> str:
280 """

Callers 1

download_and_cacheMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected