MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / NodeExecutionError

Class NodeExecutionError

include/behaviortree_cpp/exceptions.h:81–111  ·  view source on GitHub ↗

Exception thrown when a node's tick() method throws an exception. Contains information about the node where the exception originated.

Source from the content-addressed store, hash-verified

79/// Exception thrown when a node's tick() method throws an exception.
80/// Contains information about the node where the exception originated.
81class NodeExecutionError : public RuntimeError
82{
83public:
84 NodeExecutionError(TickBacktraceEntry failed_node, const std::string& original_message)
85 : RuntimeError(formatMessage(failed_node, original_message))
86 , failed_node_(std::move(failed_node))
87 , original_message_(original_message)
88 {}
89
90 /// The node that threw the exception
91 [[nodiscard]] const TickBacktraceEntry& failedNode() const
92 {
93 return failed_node_;
94 }
95
96 [[nodiscard]] const std::string& originalMessage() const
97 {
98 return original_message_;
99 }
100
101private:
102 TickBacktraceEntry failed_node_;
103 std::string original_message_;
104
105 static std::string formatMessage(const TickBacktraceEntry& node,
106 const std::string& original_msg)
107 {
108 return StrCat("Exception in node '", node.node_path, "' [", node.registration_name,
109 "]: ", original_msg);
110 }
111};
112
113} // namespace BT
114

Callers 1

executeTickMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected