From 9f4f4136f7cc4e153b5d991090c2e6dd8b39d6d2 Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 28 Dec 2020 14:10:43 +0000 Subject: [PATCH] JSBSim: FGCondition: throw better exceptions Add more description when FGCondition throws an exception, since these are somewhat frequently occurring ones. --- src/FDM/JSBSim/math/FGCondition.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/FDM/JSBSim/math/FGCondition.cpp b/src/FDM/JSBSim/math/FGCondition.cpp index d17024c47..14f94fb24 100644 --- a/src/FDM/JSBSim/math/FGCondition.cpp +++ b/src/FDM/JSBSim/math/FGCondition.cpp @@ -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."); } }