Catch Pandora_Wmi::Pandora_Wmi_Exception exceptions. Fixes #89.

This commit is contained in:
Ramon Novoa 2017-09-01 15:00:21 +02:00
parent 13894ba403
commit e90fb3d8f7
1 changed files with 7 additions and 4 deletions

View File

@ -1139,12 +1139,15 @@ Pandora_Module_Factory::getModuleFromDefinition (string definition) {
module = new Pandora_Module_Freedisk_Percent (module_name,
module_freedisk_percent);
// Added a description with the memory free
try {
char buffer[100];
unsigned long memory = Pandora_Wmi::getDiskFreeSpace(module_freedisk_percent);
if (sprintf(buffer, "Free memory %s %dMB",
module_freedisk_percent.c_str(), memory) > 0) {
module->setDescription(buffer);
}
} catch (Pandora_Wmi::Pandora_Wmi_Exception e) {
}
} else if (module_freememory != "") {
module = new Pandora_Module_Freememory (module_name);
} else if (module_freememory_percent != "") {