From 77709a2d85f28f7ffc9d4a225f38ec1341a7cc4e Mon Sep 17 00:00:00 2001 From: fgenesis Date: Mon, 18 Mar 2019 00:50:56 +0100 Subject: [PATCH] Display errors when loading XML fails --- BBGE/ReadXML.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BBGE/ReadXML.cpp b/BBGE/ReadXML.cpp index 08eda10..5294cea 100644 --- a/BBGE/ReadXML.cpp +++ b/BBGE/ReadXML.cpp @@ -1,5 +1,6 @@ #include "ReadXML.h" #include "Base.h" +#include 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; }