Skip to content

Commit

Permalink
fix: better error messages when expressions yield unexpected results
Browse files Browse the repository at this point in the history
fixes #138
  • Loading branch information
derkork committed Aug 16, 2024
1 parent 5d0fd6f commit a6d16ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/godot_state_charts/expression_guard.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func is_satisfied(context_transition:Transition, context_state:StateChartState)
var result:Variant = ExpressionUtil.evaluate_expression("guard in " + DebugUtil.path_of(context_transition), root, expression, false)

if typeof(result) != TYPE_BOOL:
push_error("Expression result is not a boolean. Returning false.")
push_error("Expression: ", expression ," result: ", result, " is not a boolean. Returning false.")
return false

return result
Expand Down
2 changes: 1 addition & 1 deletion addons/godot_state_charts/transition.gd
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func evaluate_delay() -> float:

var result = ExpressionUtil.evaluate_expression("delay of " + DebugUtil.path_of(self), parent_state._chart, delay_in_seconds, 0.0)
if typeof(result) != TYPE_FLOAT:
push_error("Expression result is not a boolean. Returning false.")
push_error("Expression: ", delay_in_seconds ," result: ", result, " is not a float. Returning 0.0.")
return 0.0

return result
Expand Down

0 comments on commit a6d16ab

Please sign in to comment.