Skip to content

Commit b07d7c1

Browse files
committed
feat: add error handling for missing actor run data and dataset in Apify tool
1 parent ab930ad commit b07d7c1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/strands_tools/apify.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,13 @@ def scrape_url(
344344
timeout_secs=timeout_secs,
345345
logger=None, # Suppress verbose apify-client logging not useful to end users
346346
)
347+
if actor_run is None:
348+
raise RuntimeError("Website Content Crawler returned no run data (possible wait timeout).")
347349
self._check_run_status(actor_run, "Website Content Crawler")
348350

349351
dataset_id = actor_run.get("defaultDatasetId")
352+
if not dataset_id:
353+
raise RuntimeError("Website Content Crawler run has no default dataset.")
350354
result = self.client.dataset(dataset_id).list_items(limit=1)
351355
items = list(result.items)
352356

0 commit comments

Comments
 (0)