#include <Pluma/DLibrary.hpp>\r
#include <Pluma/Dir.hpp>\r
#include <cstdio>\r
+#include <stdexcept>\r
\r
namespace pluma{\r
\r
registerFunction = reinterpret_cast<fnRegisterPlugin*>(lib->getSymbol("connect"));\r
\r
if(!registerFunction){\r
- fprintf(stderr, "Failed to initialize plugin \"%s\": connect function not found\n", plugName.c_str());\r
+ //fprintf(stderr, "Failed to initialize plugin \"%s\": connect function not found\n", plugName.c_str());\r
delete lib;\r
+ throw std::runtime_error(\r
+ std::string( "Failed to initialize plugin \"" ) +\r
+ plugName +\r
+ std::string( "\": connect function not found" )\r
+ );\r
return false;\r
}\r
// try to initialize plugin:\r
if (!registerFunction(host)){\r
// plugin decided to fail\r
- fprintf(stderr, "Self registry failed on plugin \"%s\".\n", plugName.c_str());\r
+ // fprintf(stderr, "Self registry failed on plugin \"%s\".\n", plugName.c_str());\r
host.cancelAddictions();\r
delete lib;\r
+ throw std::runtime_error(\r
+ std::string( "Self registry failed on plugin \"" ) +\r
+ plugName +\r
+ std::string( "\"" )\r
+ );\r
return false;\r
}\r
// Store the library if addictions are confirmed\r
libraries[plugName] = lib;\r
else{\r
// otherwise nothing was registered\r
- fprintf(stderr, "Nothing registered by plugin \"%s\".\n", plugName.c_str());\r
+ // fprintf(stderr, "Nothing registered by plugin \"%s\".\n", plugName.c_str());\r
delete lib;\r
+ throw std::runtime_error(\r
+ std::string( "Nothing registered by plugin \"" ) +\r
+ plugName +\r
+ std::string( "\"." )\r
+ );\r
return false;\r
}\r
return true;\r
////////////////////////////////////////////////////////////\r
bool PluginManager::addProvider(Provider* provider){\r
if (provider == NULL){\r
- fprintf(stderr, "Trying to add null provider\n");\r
+ // fprintf(stderr, "Trying to add null provider\n");\r
+ throw std::runtime_error( "Trying to add null provider." );\r
return false;\r
}\r
return host.registerProvider(provider);\r