Files
nadlan-mcp/nadlan_mcp
Nitzan P aa3639b05c Fix: Make _safe_calculate_metric catch all exceptions
Problem:
- test_get_market_activity_metrics was failing with "list index out of range"
- _safe_calculate_metric only caught ValueError, not IndexError or other exceptions
- This caused the entire function to crash when metric calculations failed

Root Cause:
- Market metric functions (calculate_market_activity_score, get_market_liquidity,
  analyze_investment_potential) can throw IndexError if insufficient data
- The helper function wasn't catching these exceptions

Solution:
- Changed _safe_calculate_metric to catch all exceptions (Exception instead of ValueError)
- Added logging to track which metric failed
- Now returns error dict gracefully instead of crashing

Impact:
- get_market_activity_metrics is now more robust
- Returns partial results even if some metrics fail
- All 326 tests now pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 22:54:03 +02:00
..
2025-10-30 22:24:40 +02:00
2025-10-30 22:24:40 +02:00