| 21 | } |
| 22 | |
| 23 | void TryCatchNode::halt() |
| 24 | { |
| 25 | bool catch_on_halt = false; |
| 26 | getInput("catch_on_halt", catch_on_halt); |
| 27 | |
| 28 | // If catch_on_halt is enabled and we were in the try-block (not already in catch), |
| 29 | // execute the catch child synchronously before halting. |
| 30 | if(catch_on_halt && !in_catch_ && isStatusActive(status()) && |
| 31 | children_nodes_.size() >= 2) |
| 32 | { |
| 33 | // Halt all try-block children first |
| 34 | for(size_t i = 0; i < children_nodes_.size() - 1; i++) |
| 35 | { |
| 36 | haltChild(i); |
| 37 | } |
| 38 | |
| 39 | // Tick the catch child. If it returns RUNNING, halt it too |
| 40 | // (best-effort cleanup during halt). |
| 41 | TreeNode* catch_child = children_nodes_.back(); |
| 42 | const NodeStatus catch_status = catch_child->executeTick(); |
| 43 | if(catch_status == NodeStatus::RUNNING) |
| 44 | { |
| 45 | haltChild(children_nodes_.size() - 1); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | current_child_idx_ = 0; |
| 50 | skipped_count_ = 0; |
| 51 | in_catch_ = false; |
| 52 | ControlNode::halt(); |
| 53 | } |
| 54 | |
| 55 | NodeStatus TryCatchNode::tick() |
| 56 | { |
nothing calls this directly
no test coverage detected