From 9e76460fce0c971d19ec9066c7562655f2c4cc9a Mon Sep 17 00:00:00 2001 From: Martijn Buijs Date: Mon, 8 Jun 2020 11:26:33 +0200 Subject: [PATCH 1/2] Include original exception in ComponentManagerException Signed-off-by: Martijn Buijs --- rclcpp_components/src/component_manager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rclcpp_components/src/component_manager.cpp b/rclcpp_components/src/component_manager.cpp index a80fada378..79bed4a369 100644 --- a/rclcpp_components/src/component_manager.cpp +++ b/rclcpp_components/src/component_manager.cpp @@ -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. From 668959f231f107fad188f6993f42ee40eb3d23eb Mon Sep 17 00:00:00 2001 From: Martijn Buijs Date: Wed, 24 Jun 2020 11:20:27 +0200 Subject: [PATCH 2/2] Update rclcpp_components/src/component_manager.cpp Co-authored-by: tomoya Signed-off-by: Martijn Buijs --- rclcpp_components/src/component_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rclcpp_components/src/component_manager.cpp b/rclcpp_components/src/component_manager.cpp index 79bed4a369..bfb1b5cf89 100644 --- a/rclcpp_components/src/component_manager.cpp +++ b/rclcpp_components/src/component_manager.cpp @@ -196,7 +196,7 @@ ComponentManager::OnLoadNode( try { node_wrappers_[node_id] = factory->create_node_instance(options); - } catch (const std::exception &ex) { + } catch (const std::exception & ex) { // In the case that the component constructor throws an exception, // rethrow into the following catch block. throw ComponentManagerException(