fix: broaden _log_portfolio exception catch to handle all failures

OSError only covers file I/O errors; json.dump can also raise
TypeError on non-serializable data. Use Exception to ensure logging
failures never discard analysis results.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Robin Lindbladh 2026-03-24 21:11:49 +01:00
parent 3abff48c7d
commit 2ce7e2b6d0
1 changed files with 1 additions and 1 deletions

View File

@ -63,7 +63,7 @@ class PortfolioAnalyzer:
try: try:
self._log_portfolio(trade_date, tickers, individual_results, portfolio_summary) self._log_portfolio(trade_date, tickers, individual_results, portfolio_summary)
except OSError as e: except Exception as e:
if debug: if debug:
print(f"Warning: failed to save portfolio log: {e}") print(f"Warning: failed to save portfolio log: {e}")