Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fix-silent-exception-swallowing.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Log exceptions instead of silently swallowing them during household calculations.
7 changes: 3 additions & 4 deletions policyengine_api/country.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import importlib
import logging
from flask import Response
import json
from policyengine_core.taxbenefitsystems import TaxBenefitSystem
Expand Down Expand Up @@ -445,11 +446,9 @@ def calculate(
entity_result
)
except Exception as e:
if "axes" in household:
pass
else:
logging.exception(f"Error computing {variable_name} for {entity_id}")
if "axes" not in household:
household[entity_plural][entity_id][variable_name][period] = None
print(f"Error computing {variable_name} for {entity_id}: {e}")

tracer_output = simulation.tracer.computation_log
log_lines = tracer_output.lines(aggregate=False, max_depth=10)
Expand Down
Loading