Do not continue with initialization if no plugins are found. 74/10674/1
authorOssama Othman <ossama.othman@intel.com>
Tue, 8 Oct 2013 15:04:14 +0000 (08:04 -0700)
committerOssama Othman <ossama.othman@intel.com>
Tue, 8 Oct 2013 16:41:32 +0000 (09:41 -0700)
Change-Id: I1cbb55628e0e6253920519384d16c04384abb6d7
Signed-off-by: Ossama Othman <ossama.othman@intel.com>
lib/manager.cpp

index 8fd64b0..2a29575 100644 (file)
@@ -67,7 +67,8 @@ void
 ivi::settings::manager::load_settings(std::string const & dir)
 {
   if (dir.length() == 0)
-    throw std::logic_error("Zero length settings plugin directory path.");
+    throw std::runtime_error("Zero length settings plugin "
+                             "directory path.");
 
   namespace fs = boost::filesystem;
 
@@ -111,16 +112,16 @@ ivi::settings::manager::load_settings(std::string const & dir)
     }
 
     if (settings_.size() == 0) {
-      std::cerr << "Settings plugin directory \""
-                << dir << "\" has no plugins.\n";
+      throw std::runtime_error("Settings plugin directory \""
+                               + dir + "\" has no plugins.");
     } else {
       std::cerr << "Registered settings plugins: \n";
       for (auto const & i : settings_)
         std::cerr << "\t" << i.first << '\n';
     }
   } else {
-    std::cerr << "Settings plugin directory \""
-              << dir << "\" does not exist.\n";
+    throw std::runtime_error("Settings plugin directory \""
+                             + dir + "\" does not exist.");
   }
 }