Include original exception in ComponentManagerException (#1157) (#1223)

* Include original exception in ComponentManagerException

Signed-off-by: Martijn Buijs <martijn.buijs@gmail.com>

* Update rclcpp_components/src/component_manager.cpp

Co-authored-by: tomoya <Tomoya.Fujita@sony.com>
Signed-off-by: Martijn Buijs <martijn.buijs@gmail.com>

Co-authored-by: tomoya <Tomoya.Fujita@sony.com>

Co-authored-by: Martijn Buijs <Martijn.buijs@gmail.com>
Co-authored-by: tomoya <Tomoya.Fujita@sony.com>
This commit is contained in:
Dereck Wonnacott 2020-10-01 15:42:49 -04:00 committed by GitHub
parent b67fa594f8
commit cb1b32ee15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -196,6 +196,11 @@ ComponentManager::OnLoadNode(
try {
node_wrappers_[node_id] = factory->create_node_instance(options);
} catch (const std::exception & ex) {
// In the case that the component constructor throws an exception,
// rethrow into the following catch block.
throw ComponentManagerException(
"Component constructor threw an exception: " + std::string(ex.what()));
} catch (...) {
// In the case that the component constructor throws an exception,
// rethrow into the following catch block.