| 61 | }; |
| 62 | |
| 63 | TEST(ExceptionTracking, BasicExceptionCapture) |
| 64 | { |
| 65 | // Simple tree: Sequence -> ThrowingAction |
| 66 | const char* xml = R"( |
| 67 | <root BTCPP_format="4"> |
| 68 | <BehaviorTree ID="MainTree"> |
| 69 | <ThrowingAction name="thrower"/> |
| 70 | </BehaviorTree> |
| 71 | </root> |
| 72 | )"; |
| 73 | |
| 74 | BehaviorTreeFactory factory; |
| 75 | factory.registerNodeType<ThrowingAction>("ThrowingAction"); |
| 76 | |
| 77 | auto tree = factory.createTreeFromText(xml); |
| 78 | |
| 79 | try |
| 80 | { |
| 81 | tree.tickOnce(); |
| 82 | FAIL() << "Expected NodeExecutionError to be thrown"; |
| 83 | } |
| 84 | catch(const NodeExecutionError& e) |
| 85 | { |
| 86 | // Verify the failed node info |
| 87 | EXPECT_EQ(e.failedNode().node_name, "thrower"); |
| 88 | EXPECT_EQ(e.failedNode().registration_name, "ThrowingAction"); |
| 89 | EXPECT_EQ(e.originalMessage(), "Test exception from ThrowingAction"); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | TEST(ExceptionTracking, NestedExceptionBacktrace) |
| 94 | { |
nothing calls this directly
no test coverage detected