1
0
Fork 0

JSBSim: FGCondition: throw better exceptions

Add more description when FGCondition throws an exception, since
these are somewhat frequently occurring ones.
This commit is contained in:
James Turner 2020-12-28 14:10:43 +00:00
parent 63ddc0f6ba
commit 9f4f4136f7

View file

@ -66,7 +66,7 @@ FGCondition::FGCondition(Element* element, FGPropertyManager* PropertyManager)
else { // error
cerr << element->ReadFrom()
<< "Unrecognized LOGIC token " << logic << endl;
throw std::invalid_argument("Illegal argument");
throw std::invalid_argument("JSBSim FGCondition: unrecognized logic value:'" + logic + "'");
}
} else {
Logic = eAND; // default
@ -87,7 +87,7 @@ FGCondition::FGCondition(Element* element, FGPropertyManager* PropertyManager)
cerr << condition_element->ReadFrom()
<< "Unrecognized tag <" << tagName << "> in the condition statement."
<< endl;
throw std::invalid_argument("Illegal argument");
throw std::invalid_argument("JSBSim FGCondition: unrecognized tag:'" + tagName + "'");
}
conditions.push_back(new FGCondition(condition_element, PropertyManager));
@ -119,12 +119,12 @@ FGCondition::FGCondition(const string& test, FGPropertyManager* PropertyManager,
<< " Conditional test is invalid: \"" << test
<< "\" has " << test_strings.size() << " elements in the "
<< "test condition." << endl;
throw("Error in test condition.");
throw std::invalid_argument("JSBSim FGCondition: incorrect numner of test elments:" + std::to_string(test_strings.size()));
}
Comparison = mComparison[conditional];
if (Comparison == ecUndef) {
throw("Comparison operator: \""+conditional
std::invalid_argument("JSBSim FGCondition: Comparison operator: \""+conditional
+"\" does not exist. Please check the conditional.");
}
}