Commit 5c2b4796 authored by Daniel Brown's avatar Daniel Brown Committed by Sean Leavey
Browse files

more usefull error message on symbolic eval math errors

parent 6f3b1c90
......@@ -310,10 +310,13 @@ class ModelElement:
self._params_changing = set(
p for p in reversed(self.parameters) if p.is_changing
)
self._params_evald = {
p.name: (p.value.eval() if hasattr(p.value, "eval") else p.value)
for p in reversed(self.parameters)
}
try:
self._params_evald = {}
for p in reversed(self.parameters):
self._params_evald[p.name] = (p.value.eval() if hasattr(p.value, "eval") else p.value)
except ArithmeticError as ex:
ex.args = (f"Error evaluating {p}: {str(ex)}",)
raise ex
def _clear_changing_params(self):
"""Sets the set `self._params_changing` and the dict `self._params_evald` to None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment