Improved the logging when there are issues with invalid theme XML files.

This commit is contained in:
Leon Styhre 2021-02-08 20:53:39 +01:00
parent ae4abace8c
commit 3922fdd40a

View file

@ -299,10 +299,9 @@ void ThemeData::parseIncludes(const pugi::xml_node& root)
std::string relPath = resolvePlaceholders(node.text().as_string()); std::string relPath = resolvePlaceholders(node.text().as_string());
std::string path = Utils::FileSystem::resolveRelativePath(relPath, mPaths.back(), true); std::string path = Utils::FileSystem::resolveRelativePath(relPath, mPaths.back(), true);
if (!ResourceManager::getInstance()->fileExists(path)) if (!ResourceManager::getInstance()->fileExists(path))
throw error << ": Included file \"" << relPath << throw error << " -> \"" << relPath <<
"\" not found (resolved to \"" << path << "\")"; "\" not found (resolved to \"" << path << "\")";
error << " -> \"" << relPath << "\"";
error << " from included file \"" << relPath << "\":\n ";
mPaths.push_back(path); mPaths.push_back(path);
@ -314,11 +313,11 @@ void ThemeData::parseIncludes(const pugi::xml_node& root)
pugi::xml_parse_result result = includeDoc.load_file(path.c_str()); pugi::xml_parse_result result = includeDoc.load_file(path.c_str());
#endif #endif
if (!result) if (!result)
throw error << "Error parsing file: \n " << result.description(); throw error << ": Error parsing file: " << result.description();
pugi::xml_node theme = includeDoc.child("theme"); pugi::xml_node theme = includeDoc.child("theme");
if (!theme) if (!theme)
throw error << "Missing <theme> tag"; throw error << "Missing <theme> tag ";
parseVariables(theme); parseVariables(theme);
parseIncludes(theme); parseIncludes(theme);