From: <pmi...@us...> - 2009-08-31 20:27:37
|
Revision: 23402 http://personalrobots.svn.sourceforge.net/personalrobots/?rev=23402&view=rev Author: pmihelich Date: 2009-08-31 20:27:30 +0000 (Mon, 31 Aug 2009) Log Message: ----------- image_transport: Catch exception if fail to load a plugin library. Modified Paths: -------------- pkg/trunk/stacks/common/image_transport/src/image_publisher.cpp Modified: pkg/trunk/stacks/common/image_transport/src/image_publisher.cpp =================================================================== --- pkg/trunk/stacks/common/image_transport/src/image_publisher.cpp 2009-08-31 20:16:11 UTC (rev 23401) +++ pkg/trunk/stacks/common/image_transport/src/image_publisher.cpp 2009-08-31 20:27:30 UTC (rev 23402) @@ -72,13 +72,19 @@ impl_->topic = topic; BOOST_FOREACH(const std::string& lookup_name, impl_->loader.getDeclaredClasses()) { - ROS_INFO("Loading %s", lookup_name.c_str()); - PublisherPlugin* pub = impl_->loader.createClassInstance(lookup_name); - impl_->publishers.push_back(pub); - // @todo: support overriding the topic names - std::string sub_topic = pub->getDefaultTopic(topic); - nh.setParam(sub_topic + "/transport_type", pub->getTransportType()); - pub->advertise(nh, sub_topic, queue_size, latch); + //ROS_INFO("Loading %s", lookup_name.c_str()); + try { + PublisherPlugin* pub = impl_->loader.createClassInstance(lookup_name); + impl_->publishers.push_back(pub); + // @todo: support overriding the topic names + std::string sub_topic = pub->getDefaultTopic(topic); + nh.setParam(sub_topic + "/transport_type", pub->getTransportType()); + pub->advertise(nh, sub_topic, queue_size, latch); + } + catch (const std::runtime_error& e) { + ROS_WARN("Failed to load plugin %s, error string: %s", + lookup_name.c_str(), e.what()); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |