Catch exceptions when applying user edits.

This commit is contained in:
Oliver Hamlet
2015-07-16 15:57:34 +01:00
parent 45f7dc260f
commit 74ede8949d
+12 -2
View File
@@ -247,8 +247,18 @@ namespace loot {
else if (requestName == "editorClosed") {
BOOST_LOG_TRIVIAL(debug) << "Editor for plugin closed.";
// One argument, which is the plugin metadata that has changed (+ its name).
callback->Success(ApplyUserEdits(request["args"][0]));
--_lootState.numUnappliedChanges;
try {
callback->Success(ApplyUserEdits(request["args"][0]));
--_lootState.numUnappliedChanges;
}
catch (loot::error &e) {
BOOST_LOG_TRIVIAL(error) << "Failed to apply plugin metadata. Details: " << e.what();
callback->Failure(e.code(), (boost::format(loc::translate("Failed to apply plugin metadata. Details: %1%")) % e.what()).str());
}
catch (std::exception& e) {
BOOST_LOG_TRIVIAL(error) << "Failed to apply plugin metadata. Details: " << e.what();
callback->Failure(-1, (boost::format(loc::translate("Failed to apply plugin metadata. Details: %1%")) % e.what()).str());
}
return true;
}
else if (requestName == "closeSettings") {