action handler helper function - download_file_safe (#2721)

This commit is contained in:
Shuchang Zheng
2025-06-14 16:31:17 -07:00
committed by GitHub
parent 15573836ce
commit 90e6038cd6
2 changed files with 21 additions and 9 deletions

View File

@@ -0,0 +1,19 @@
from typing import Any
import structlog
from skyvern.forge.sdk.api.files import download_file
LOG = structlog.get_logger()
async def download_file_safe(file_url: str, action: dict[str, Any] | None = None) -> str | list[str]:
try:
return await download_file(file_url)
except Exception:
LOG.exception(
"Failed to download file, continuing without it",
action=action,
file_url=file_url,
)
return []