skip exception if pre block screenshot failed (#3652)

This commit is contained in:
LawyZheng
2025-10-09 12:41:19 +08:00
committed by GitHub
parent 89931b50ca
commit 1424c25f43

View File

@@ -344,6 +344,7 @@ class Block(BaseModel, abc.ABC):
if not browser_state: if not browser_state:
LOG.warning("No browser state found when creating workflow_run_block", workflow_run_id=workflow_run_id) LOG.warning("No browser state found when creating workflow_run_block", workflow_run_id=workflow_run_id)
else: else:
try:
screenshot = await browser_state.take_fullpage_screenshot( screenshot = await browser_state.take_fullpage_screenshot(
use_playwright_fullpage=app.EXPERIMENTATION_PROVIDER.is_feature_enabled_cached( use_playwright_fullpage=app.EXPERIMENTATION_PROVIDER.is_feature_enabled_cached(
"ENABLE_PLAYWRIGHT_FULLPAGE", "ENABLE_PLAYWRIGHT_FULLPAGE",
@@ -351,6 +352,13 @@ class Block(BaseModel, abc.ABC):
properties={"organization_id": str(organization_id)}, properties={"organization_id": str(organization_id)},
) )
) )
except Exception:
LOG.warning(
"Failed to take screenshot before executing the block, ignoring the exception",
workflow_run_id=workflow_run_id,
workflow_run_block_id=workflow_run_block_id,
)
screenshot = None
if screenshot: if screenshot:
await app.ARTIFACT_MANAGER.create_workflow_run_block_artifact( await app.ARTIFACT_MANAGER.create_workflow_run_block_artifact(
workflow_run_block=workflow_run_block, workflow_run_block=workflow_run_block,