Add logging for a few exceptions

This commit is contained in:
Oliver Hamlet
2016-12-15 18:04:37 +00:00
parent 318e69af7d
commit d5698a8ff9
3 changed files with 12 additions and 8 deletions
+8 -8
View File
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: LOOT 0.10.1\n"
"Report-Msgid-Bugs-To: https://github.com/loot/loot/issues\n"
"POT-Creation-Date: 2016-12-14 21:55+0000\n"
"POT-Creation-Date: 2016-12-15 18:04+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -635,14 +635,14 @@ msgstr ""
msgid "Parsing, merging and evaluating metadata..."
msgstr ""
#: src/gui/query/get_game_data_query.h:79
#: src/gui/query/get_game_data_query.h:80
msgid ""
"An error occurred while parsing the masterlist: %1%. This probably happened "
"because an update to LOOT changed its metadata syntax support. Try updating "
"your masterlist to resolve the error."
msgstr ""
#: src/gui/query/get_game_data_query.h:93
#: src/gui/query/get_game_data_query.h:95
msgid ""
"An error occurred while parsing the userlist: %1%. This probably happened "
"because an update to LOOT changed its metadata syntax support. Your user "
@@ -657,25 +657,25 @@ msgid ""
"[LOOT's website](https://loot.github.io/)."
msgstr ""
#: src/gui/query/metadata_query.h:90 src/gui/query/metadata_query.h:91
#: src/gui/query/metadata_query.h:91 src/gui/query/metadata_query.h:92
msgid "N/A: No masterlist present"
msgstr ""
#: src/gui/query/metadata_query.h:93 src/gui/query/metadata_query.h:94
#: src/gui/query/metadata_query.h:95 src/gui/query/metadata_query.h:96
msgid "Unknown: Git repository missing"
msgstr ""
#: src/gui/query/metadata_query.h:117
#: src/gui/query/metadata_query.h:119
msgid ""
"A global message contains a condition that could not be evaluated. Details: "
"%1%"
msgstr ""
#: src/gui/query/metadata_query.h:143 src/backend/plugin/plugin_sorter.cpp:217
#: src/gui/query/metadata_query.h:145 src/backend/plugin/plugin_sorter.cpp:217
msgid "\"%1%\" contains a condition that could not be evaluated. Details: %2%"
msgstr ""
#: src/gui/query/metadata_query.h:174 src/gui/query/metadata_query.h:175
#: src/gui/query/metadata_query.h:176 src/gui/query/metadata_query.h:177
msgid "(edited)"
msgstr ""
+2
View File
@@ -75,6 +75,7 @@ private:
try {
state_.getCurrentGame().GetMasterlist().Load(state_.getCurrentGame().MasterlistPath());
} catch (std::exception &e) {
BOOST_LOG_TRIVIAL(error) << "An error occurred while parsing \"" << state_.getCurrentGame().MasterlistPath() << "\": " << e.what();
state_.getCurrentGame().GetMasterlist().AppendMessage(Message(MessageType::error, (boost::format(boost::locale::translate(
"An error occurred while parsing the masterlist: %1%. "
"This probably happened because an update to LOOT changed "
@@ -89,6 +90,7 @@ private:
try {
state_.getCurrentGame().GetUserlist().Load(state_.getCurrentGame().UserlistPath());
} catch (std::exception &e) {
BOOST_LOG_TRIVIAL(error) << "An error occurred while parsing \"" << state_.getCurrentGame().UserlistPath() << "\": " << e.what();
state_.getCurrentGame().GetUserlist().AppendMessage(Message(MessageType::error, (boost::format(boost::locale::translate(
"An error occurred while parsing the userlist: %1%. "
"This probably happened because an update to LOOT changed "
+2
View File
@@ -87,9 +87,11 @@ protected:
masterlistNode["revision"] = info.revision_id;
masterlistNode["date"] = info.revision_date;
} catch (FileAccessError &) {
BOOST_LOG_TRIVIAL(warning) << "No masterlist present at " << state_.getCurrentGame().MasterlistPath();
masterlistNode["revision"] = translate("N/A: No masterlist present").str();
masterlistNode["date"] = translate("N/A: No masterlist present").str();
} catch (GitStateError &) {
BOOST_LOG_TRIVIAL(warning) << "Not a Git repository: " << state_.getCurrentGame().MasterlistPath().parent_path();
masterlistNode["revision"] = translate("Unknown: Git repository missing").str();
masterlistNode["date"] = translate("Unknown: Git repository missing").str();
}