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-runner-parameter-not-found.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Handle missing parameter errors gracefully in PolicyEngineRunner instead of crashing.
7 changes: 4 additions & 3 deletions policyengine_taxsim/runners/policyengine_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ def _extract_vectorized_results(
arr = self._calc_tax_unit(sim, resolved, year_str)
var_sum += arr
except Exception as e:
if "does not exist" in str(e):
if "does not exist" in str(e) or "was not found" in str(e):
if self.logs:
print(
f"Variable {resolved} not implemented, setting to 0"
Expand All @@ -1061,7 +1061,7 @@ def _extract_vectorized_results(
arr = self._calc_tax_unit(sim, resolved, year_str)
result_array[state_mask] = arr[state_mask]
except Exception as e:
if "does not exist" in str(e):
if "does not exist" in str(e) or "was not found" in str(e):
if self.logs:
print(
f"Variable {resolved} not implemented, setting to 0"
Expand All @@ -1085,7 +1085,8 @@ def _extract_vectorized_results(
columns[taxsim_var] = np.round(arr, 2)

except Exception as e:
if "does not exist" in str(e):
err_msg = str(e)
if "does not exist" in err_msg or "was not found" in err_msg:
if self.logs:
print(
f"Variable {pe_var} not implemented, setting to 0"
Expand Down