1919#include < algorithm>
2020#include < memory>
2121#include < string>
22+ #include < unordered_set>
23+ #include < vector>
2224
2325#include " pluginlib/class_loader.hpp"
2426
@@ -160,19 +162,38 @@ class StorageFactoryImpl
160162
161163 virtual ~StorageFactoryImpl () = default ;
162164
165+ std::unordered_set<std::string> get_registered_plugin_names ()
166+ {
167+ std::vector<std::string> read_only_plugins = read_only_class_loader_->getDeclaredClasses ();
168+ std::vector<std::string> read_write_plugins = read_write_class_loader_->getDeclaredClasses ();
169+
170+ // Merge read-only and read-write plugins
171+ std::unordered_set<std::string> combined_plugins (
172+ read_only_plugins.begin (), read_only_plugins.end ());
173+ combined_plugins.insert (read_write_plugins.begin (), read_write_plugins.end ());
174+ return combined_plugins;
175+ }
176+
163177 std::shared_ptr<ReadWriteInterface> open_read_write (const StorageOptions & storage_options)
164178 {
165- auto instance =
166- get_interface_instance (read_write_class_loader_, storage_options);
179+ auto instance = get_interface_instance (read_write_class_loader_, storage_options);
167180
168181 if (instance == nullptr ) {
169182 if (storage_options.storage_id .empty ()) {
170183 ROSBAG2_STORAGE_LOG_ERROR_STREAM (
171- " No storage id specified, and no plugin found that could open URI" );
184+ " No storage id specified, and no plugin found that could open URI: '" <<
185+ storage_options.uri << " '" );
172186 } else {
173187 ROSBAG2_STORAGE_LOG_ERROR_STREAM (
174188 " Could not load/open plugin with storage id '" << storage_options.storage_id << " '" );
175189 }
190+ auto available_plugins = read_write_class_loader_->getDeclaredClasses ();
191+ std::stringstream ss;
192+ ss << " Available read-write storage plugins: " ;
193+ for (const auto & storage_plugin : available_plugins) {
194+ ss << " '" << storage_plugin << " ', " ;
195+ }
196+ ROSBAG2_STORAGE_LOG_INFO (" %s" , ss.str ().c_str ());
176197 }
177198
178199 return instance;
@@ -193,11 +214,19 @@ class StorageFactoryImpl
193214 if (instance == nullptr ) {
194215 if (storage_options.storage_id .empty ()) {
195216 ROSBAG2_STORAGE_LOG_ERROR_STREAM (
196- " No storage id specified, and no plugin found that could open URI" );
217+ " No storage id specified, and no plugin found that could open URI: '" <<
218+ storage_options.uri << " '" );
197219 } else {
198220 ROSBAG2_STORAGE_LOG_ERROR_STREAM (
199- " Could not load/open plugin with storage id '" << storage_options.storage_id << " '" );
221+ " Could not load/open plugin with storage id: '" << storage_options.storage_id << " '" );
222+ }
223+ auto available_plugins = get_registered_plugin_names ();
224+ std::stringstream ss;
225+ ss << " Available storage plugins: " ;
226+ for (const auto & storage_plugin : available_plugins) {
227+ ss << " '" << storage_plugin << " ', " ;
200228 }
229+ ROSBAG2_STORAGE_LOG_INFO (" %s" , ss.str ().c_str ());
201230 }
202231
203232 return instance;
0 commit comments