mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 09:44:02 +00:00
Display errors when loading XML fails
This commit is contained in:
parent
b7a6b52fe5
commit
77709a2d85
1 changed files with 10 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
#include "ReadXML.h"
|
||||
#include "Base.h"
|
||||
#include <sstream>
|
||||
|
||||
tinyxml2::XMLError readXML(const std::string& fn, tinyxml2::XMLDocument& doc)
|
||||
{
|
||||
|
@ -18,6 +19,15 @@ tinyxml2::XMLDocument *readXML(const std::string& fn, tinyxml2::XMLError *perr /
|
|||
*perr = err;
|
||||
if(err != tinyxml2::XML_SUCCESS && !keepEmpty)
|
||||
{
|
||||
const char *e1 = doc->GetErrorStr1();
|
||||
const char *e2 = doc->GetErrorStr2();
|
||||
std::ostringstream os;
|
||||
os << "readXML(" << fn << ") failed!\n";
|
||||
if(e1)
|
||||
os << e1 << "\n";
|
||||
if(e2)
|
||||
os << e2 << "\n";
|
||||
errorLog(os.str());
|
||||
delete doc;
|
||||
doc = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue