Skip to content

Log exceptions instead of silently swallowing them in calculate#3323

Open
MaxGhenis wants to merge 1 commit intomasterfrom
fix-silent-exception-swallowing
Open

Log exceptions instead of silently swallowing them in calculate#3323
MaxGhenis wants to merge 1 commit intomasterfrom
fix-silent-exception-swallowing

Conversation

@MaxGhenis
Copy link
Collaborator

Summary

  • Replace silent pass in axes exception handler with logging.exception() so errors are visible in production logs
  • Remove redundant print() in the non-axes path (now handled by the shared logging.exception())
  • The axes code path previously discarded all exceptions silently, causing variables to return null with no trace (e.g., the NJ reform bug reported in clone()-based reform path breaks ParameterNode iteration, silently fails for NJ #3322)

Fixes #3322

Test plan

  • Verify exception logging works by checking Cloud Logging after deployment
  • Existing tests unaffected (no behavioral change for callers — just logging added)

🤖 Generated with Claude Code

@codecov
Copy link

codecov bot commented Mar 10, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.24%. Comparing base (0ab47d3) to head (20dee2b).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
policyengine_api/country.py 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3323      +/-   ##
==========================================
+ Coverage   72.20%   72.24%   +0.04%     
==========================================
  Files          56       56              
  Lines        2425     2425              
  Branches      423      423              
==========================================
+ Hits         1751     1752       +1     
+ Misses        595      594       -1     
  Partials       79       79              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The axes code path silently discarded all exceptions (`pass`),
causing variables like NJ gross income to return null with no
error trace. Now logs the full traceback via logging.exception().

Fixes #3322

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MaxGhenis MaxGhenis force-pushed the fix-silent-exception-swallowing branch from 7d20783 to 20dee2b Compare March 10, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clone()-based reform path breaks ParameterNode iteration, silently fails for NJ

1 participant