diff --git a/src/backend/git.cpp b/src/backend/git.cpp index e09c9af7..99a4b7aa 100644 --- a/src/backend/git.cpp +++ b/src/backend/git.cpp @@ -442,7 +442,7 @@ namespace loot { git.call(git_checkout_head(git.repo, &checkout_opts)); if (parsingError.empty()) - parsingError = boost::locale::translate("Masterlist revision").str() + " " + string(revision) + ": " + e.what() + " " + boost::locale::translate("Rolled back to the previous revision.").str(); + parsingError = boost::locale::translate("Masterlist revision").str() + " " + string(revision) + ": " + e.what() + ". " + boost::locale::translate("Rolled back to the previous revision.").str(); } } while (parsingFailed); diff --git a/src/gui/handler.cpp b/src/gui/handler.cpp index 4977bcef..62000bc9 100644 --- a/src/gui/handler.cpp +++ b/src/gui/handler.cpp @@ -686,6 +686,7 @@ namespace loot { std::string Handler::UpdateMasterlist() { BOOST_LOG_TRIVIAL(debug) << "Updating and parsing masterlist."; + string parsingError; //Set language. unsigned int language; @@ -696,7 +697,18 @@ namespace loot { BOOST_LOG_TRIVIAL(info) << "Using message language: " << Language(language).Name(); // Update / parse masterlist. - g_app_state.CurrentGame().masterlist.Load(g_app_state.CurrentGame(), language); + try { + g_app_state.CurrentGame().masterlist.Load(g_app_state.CurrentGame(), language); + } + catch (loot::error &e) { + if (e.code() == loot::error::ok) { + // There was a parsing error, but roll-back was successful, so the process + // should still complete. + parsingError = e.what(); + } + else + throw e; + } // Now regenerate the JS-side masterlist data. @@ -751,6 +763,11 @@ namespace loot { messages.push_back(Message(Message::error, (format(loc::translate("A global message contains a condition that could not be evaluated. Details: %1%")) % e.what()).str())); } + // Add the parsing error to the global messages, if it exists. + if (!parsingError.empty()) { + messages.push_back(Message(Message::error, parsingError)); + } + // Now store global messages from masterlist. gameNode["globalMessages"] = messages;