diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-10-14 13:49:32 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-10-14 13:50:19 +0200 |
commit | ce01a7fdc8d49977e3d46dab0615580f90c6525c (patch) | |
tree | ee96c6e0e41770818a9afb7c3a28dcc5136a029d | |
parent | a71ebe62e75db9402d89c6af1ab69051440bf892 (diff) |
eval: forward exceptions in `if` conditions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | eval.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -454,8 +454,11 @@ ut_execute_if(struct ut_state *state, uint32_t off) uint32_t cond = op ? op->tree.operand[0] : 0; uint32_t Then = op ? op->tree.operand[1] : 0; uint32_t Else = op ? op->tree.operand[2] : 0; + bool res = ut_test_condition(state, cond); - if (ut_test_condition(state, cond)) + if (state->exception) + return json_object_get(state->exception); + else if (res) return ut_execute_op_sequence(state, Then); else if (Else) return ut_execute_op_sequence(state, Else); |