Skip to content

Commit 7ddd17a

Browse files
Rework assert to also give quick introspection of what is wrong
Signed-off-by: Christian Parpart <[email protected]>
1 parent 6f8a418 commit 7ddd17a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/frequenz/sdk/timeseries/_formula_engine/_formula_formatter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ def _format(self, postfix_expr: list[FormulaStep]) -> str:
244244
case OpenParen():
245245
pass # We gently ignore this one.
246246

247-
assert len(self._stack) == 1
247+
assert (
248+
len(self._stack) == 1
249+
), f"The formula {postfix_expr} is not valid. Evaluation stack left-over: {self._stack}"
248250
return self._stack[0].value
249251

250252
def _format_binary(self, operator: Operator) -> None:

0 commit comments

Comments
 (0)