Improve diagnostic and fix code layout
@@ -253,7 +253,8 @@ string findPlugin(string name, string _type, string _plugin_path, PLUGIN_TYPE ty
/**
* Set Plugin Type
*/
-void PluginManager::setPluginType(tPluginType type) {
+void PluginManager::setPluginType(tPluginType type)
+{
m_pluginType = type;
}
@@ -313,7 +314,7 @@ char buf[MAXPATHLEN];
doc.Parse(json.c_str());
if (doc.HasParseError())
{
- Logger::getLogger()->error("Parse error for JSON plugin config in '%s': %s at %d", json.c_str(),
+ Logger::getLogger()->error("Parse error for JSON plugin config in '%s': %s at %d", name.c_str(),
GetParseError_En(doc.GetParseError()), (unsigned)doc.GetErrorOffset());
return NULL;
}
@@ -330,8 +331,11 @@ char buf[MAXPATHLEN];
json_base_plugin_name = doc["connection"].GetString();
if (doc.HasMember("description") && doc["description"].IsString())
+ {
json_plugin_description = doc["description"].GetString();
- if (doc["defaults"].IsObject()) {
+ }
+ if (doc["defaults"].IsObject())
+ {
rapidjson::StringBuffer sb;
rapidjson::Writer<rapidjson::StringBuffer> writer( sb );
doc["defaults"].Accept( writer );
@@ -355,7 +359,8 @@ char buf[MAXPATHLEN];
if (m_pluginType == PLUGIN_TYPE_ID_STORAGE)
{
pluginHandle = new BinaryPluginHandle(name.c_str(), buf, PLUGIN_TYPE_ID_STORAGE);
- } else
+ }
+ else
{
pluginHandle = new BinaryPluginHandle(name.c_str(), buf);
}
@@ -400,9 +405,7 @@ char buf[MAXPATHLEN];
else
{
logger->error("PluginManager: Failed to load C plugin %s in %s: %s.",
- name.c_str(),
- buf,
- dlerror());
+ name.c_str(), buf, dlerror());
}
return hndl;
}
@@ -425,7 +428,8 @@ char buf[MAXPATHLEN];
else if (type.compare(PLUGIN_TYPE_NORTH) == 0)
{
pluginHandle = new NorthPythonPluginHandle(name.c_str(), buf);
- } else
+ }
+ else
{
pluginHandle = new SouthPythonPluginHandle(name.c_str(), buf);
}
@@ -490,7 +494,7 @@ char buf[MAXPATHLEN];
return NULL;
}
- logger->error("PluginManager: Failed to load C/python plugin '%s' ", name.c_str());
+ logger->error("PluginManager: Failed to load plugin '%s' as any of the recognised types. Check that the plugin exists and the plugin name and installation directory match", name.c_str());
return NULL;
}
