mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fixed masterlist update roll-back causing issues.
Like the UI not being updated, because the updater function was exiting early.
This commit is contained in:
+1
-1
@@ -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);
|
||||
|
||||
|
||||
+18
-1
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user