mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
feature #212: Catch exception when initializing a VM object
This commit is contained in:
parent
8a15d380f6
commit
161da30c52
@ -15,6 +15,7 @@
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
#include "VirtualMachinePoolXML.h"
|
||||
#include <stdexcept>
|
||||
|
||||
int VirtualMachinePoolXML::set_up()
|
||||
{
|
||||
@ -88,9 +89,19 @@ void VirtualMachinePoolXML::add_object(xmlNodePtr node)
|
||||
}
|
||||
else
|
||||
{
|
||||
VirtualMachineXML* vm = new VirtualMachineXML( message );
|
||||
try
|
||||
{
|
||||
VirtualMachineXML* vm = new VirtualMachineXML( message );
|
||||
|
||||
objects.insert( pair<int,ObjectXML*>(vid, vm) );
|
||||
objects.insert( pair<int,ObjectXML*>(vid, vm) );
|
||||
}
|
||||
catch(runtime_error& re)
|
||||
{
|
||||
ostringstream oss_re;
|
||||
|
||||
oss_re << re.what();
|
||||
NebulaLog::log("VM",Log::ERROR,oss_re);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ void ObjectXML::xml_parse(const string &xml_doc)
|
||||
|
||||
if (xml == 0)
|
||||
{
|
||||
throw("Error parsing XML Document");
|
||||
throw runtime_error("Error parsing XML Document");
|
||||
}
|
||||
|
||||
ctx = xmlXPathNewContext(xml);
|
||||
@ -210,7 +210,7 @@ void ObjectXML::xml_parse(const string &xml_doc)
|
||||
if (ctx == 0)
|
||||
{
|
||||
xmlFreeDoc(xml);
|
||||
throw("Unable to create new XPath context");
|
||||
throw runtime_error("Unable to create new XPath context");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user