mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Don't throw then immediately catch and rethrow
This commit is contained in:
@@ -77,26 +77,23 @@ bool ConditionalMetadata::ParseCondition(Game * game) const {
|
||||
|
||||
ConditionGrammar<string::const_iterator, boost::spirit::qi::space_type> grammar(game);
|
||||
boost::spirit::qi::space_type skipper;
|
||||
string::const_iterator begin, end;
|
||||
|
||||
begin = condition_.begin();
|
||||
end = condition_.end();
|
||||
string::const_iterator begin = condition_.begin();
|
||||
string::const_iterator end = condition_.end();
|
||||
bool parseResult;
|
||||
bool evaluation;
|
||||
|
||||
try {
|
||||
bool evaluation;
|
||||
bool parseResult = boost::spirit::qi::phrase_parse(begin, end, grammar, skipper, evaluation);
|
||||
|
||||
if (!parseResult || begin != end) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Failed to parse condition \"" << condition_ << "\": only partially matched expected syntax.";
|
||||
throw ConditionSyntaxError((boost::format(translate("Failed to parse condition \"%1%\": only partially matched expected syntax.")) % condition_).str());
|
||||
}
|
||||
|
||||
return evaluation;
|
||||
} catch (ConditionSyntaxError& e) {
|
||||
throw;
|
||||
} catch (exception& e) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Failed to evaluate condition \"" << condition_ << "\": " << e.what();
|
||||
throw;
|
||||
}
|
||||
|
||||
if (!parseResult || begin != end) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Failed to parse condition \"" << condition_ << "\": only partially matched expected syntax.";
|
||||
throw ConditionSyntaxError((boost::format(translate("Failed to parse condition \"%1%\": only partially matched expected syntax.")) % condition_).str());
|
||||
}
|
||||
|
||||
return evaluation;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user