fix: add exception handling for block instantiation in get_stats

Matches existing defensive pattern in get_missing_items() (lines 188-200).
Prevents a single broken block from crashing the stats endpoint.

Addresses CodeRabbit review comment.
This commit is contained in:
Otto
2026-02-06 16:12:53 +00:00
parent e1c3f9b097
commit b20a907462

View File

@@ -267,7 +267,11 @@ class BlockHandler(ContentHandler):
# Filter out disabled blocks and excluded blocks - they're not indexed
enabled_block_ids = []
for block_id, block_cls in all_blocks.items():
block_instance = block_cls()
try:
block_instance = block_cls()
except Exception as e:
logger.warning(f"Failed to instantiate block {block_id}: {e}")
continue
if block_instance.disabled:
continue
if (