Skip to content

Commit

Permalink
fix: add error handling for invalid total items in collection retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovler-Young committed Nov 20, 2024
1 parent 7a1f599 commit 3c77c30
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ia_collection_analyzer/iahelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ def get_collection(collection_id, progress_hook=None) -> list:
)
collection = []
total_items = search.num_found
try:
total_items = int(search.num_found)
except ValueError:
total_items = 0
logger.error(f"Failed to get total items for {collection_id}: search.num_found={search.num_found}")
return []
if progress_hook:
progress_hook(0, total_items)
for result in tqdm(
Expand Down

0 comments on commit 3c77c30

Please sign in to comment.